From 5edb6eb0d374686c2f3b959b40a66fcc4a1ef2f6 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Sun, 12 Aug 2007 21:15:50 +0000 Subject: [PATCH] list.h: remove max_count as it was unused, disable list name tracking --- src/list.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/list.h b/src/list.h index 7171b16..e9362e8 100644 --- a/src/list.h +++ b/src/list.h @@ -171,22 +171,20 @@ typedef struct StatList StatList; struct StatList { List head; int cur_count; - int max_count; +#ifdef LIST_DEBUG const char *name; +#endif }; +#ifdef LIST_DEBUG +#define STATLIST(var) StatList var = { {&var.head, &var.head}, 0, #var } +#else +#define STATLIST(var) StatList var = { {&var.head, &var.head}, 0 } +#endif + static inline void statlist_inc_count(StatList *list, int val) { list->cur_count += val; - if (list->cur_count > list->max_count) - list->max_count = list->cur_count; -} - -#define STATLIST(var) StatList var = { {&var.head, &var.head}, 0, 0, #var } - -static inline void statlist_reset(StatList *list) -{ - list->max_count = list->cur_count; } static inline void statlist_prepend(List *item, StatList *list) @@ -224,8 +222,10 @@ static inline void statlist_remove(List *item, StatList *list) static inline void statlist_init(StatList *list, const char *name) { list_init(&list->head); + list->cur_count = 0; +#ifdef LIST_DEBUG list->name = name; - list->cur_count = list->max_count = 0; +#endif } static inline int statlist_count(StatList *list) @@ -234,12 +234,6 @@ static inline int statlist_count(StatList *list) return list->cur_count; } -static inline int statlist_max(StatList *list) -{ - return list->max_count > list->cur_count - ? list->max_count : list->cur_count; -} - static inline List *statlist_pop(StatList *list) { List *item = list_pop(&list->head); -- 2.40.0