From: Florian Forster Date: Mon, 20 Nov 2006 16:47:26 +0000 (+0100) Subject: src/utils_ignorelist.[ch]: Remove the `ignorelist_num' function and associated code. X-Git-Tag: collectd-3.11.0~51 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9674512a648641868b28c0c29802ba9de92bbfe5;p=collectd.git src/utils_ignorelist.[ch]: Remove the `ignorelist_num' function and associated code. --- diff --git a/src/utils_ignorelist.c b/src/utils_ignorelist.c index 1adfbc6b..31a3e665 100644 --- a/src/utils_ignorelist.c +++ b/src/utils_ignorelist.c @@ -1,5 +1,5 @@ /** - * collectd - src/config_list.c + * collectd - src/utils_ignorelist.c * Copyright (C) 2006 Lubos Stanek * * This program is free software; you can redistribute it and/ @@ -67,7 +67,6 @@ typedef struct ignorelist_item_s ignorelist_item_t; struct ignorelist_s { int ignore; /* ignore entries */ - int num; /* number of entries */ ignorelist_item_t *head; /* pointer to the first entry */ }; @@ -81,8 +80,6 @@ static inline void ignorelist_append (ignorelist_t *il, ignorelist_item_t *item) item->next = il->head; il->head = item; - - il->num++; } #if HAVE_REGEX_H @@ -246,9 +243,7 @@ void ignorelist_free (ignorelist_t *il) for (this = il->head; this != NULL; this = next) { - DBG ("free - item = 0x%p, numlist %i", (void *) this, il->num); next = this->next; - il->num--; #if HAVE_REGEX_H if (this->rmatch != NULL) { @@ -263,11 +258,7 @@ void ignorelist_free (ignorelist_t *il) } sfree (this); } -#if COLLECTD_DEBUG - if (il->num != 0) - DBG ("after free numlist: %i", il->num); -#endif - il->num = 0; + sfree (il); il = NULL; } /* void ignorelist_destroy (ignorelist_t *il) */ @@ -287,21 +278,6 @@ void ignorelist_set_invert (ignorelist_t *il, int invert) } /* void ignorelist_set_invert (ignorelist_t *il, int ignore) */ /* - * get number of entries in the ignorelist_t - * return int number - */ -int ignorelist_num (ignorelist_t *il) -{ - if (il == NULL) - { - DBG("get num called with ignorelist_t == NULL"); - return (0); - } - - return (il->num); -} /* int ignorelist_num (ignorelist_t *il) */ - -/* * append entry into ignorelist_t * return 1 for success */ @@ -358,7 +334,7 @@ int ignorelist_match (ignorelist_t *il, const char *entry) ignorelist_item_t *traverse; /* if no entries, collect all */ - if (ignorelist_num(il) == 0) + if (il->head == NULL) return (0); /* traverse list and check entries */ diff --git a/src/utils_ignorelist.h b/src/utils_ignorelist.h index e7cce66a..b47b55ad 100644 --- a/src/utils_ignorelist.h +++ b/src/utils_ignorelist.h @@ -1,5 +1,5 @@ /** - * collectd - src/config_list.h + * collectd - src/utils_ignorelist.h * Copyright (C) 2006 Lubos Stanek * * This program is free software; you can redistribute it and/ @@ -54,11 +54,6 @@ void ignorelist_free (ignorelist_t *il); * set ignore state of the ignorelist_t */ void ignorelist_set_invert (ignorelist_t *il, int invert); -/* - * get number of entries in the ignorelist_t - * return int number - */ -int ignorelist_num (ignorelist_t *il); /* * append entry to ignorelist_t