diff --git a/src/utils_ignorelist.c b/src/utils_ignorelist.c
index 1adfbc6b06899c2c58fcc66622fa643a1fe97f7f..532eb4b0029837318cf60a2adbecf901a2590b3a 100644 (file)
--- a/src/utils_ignorelist.c
+++ b/src/utils_ignorelist.c
/**
- * collectd - src/config_list.c
+ * collectd - src/utils_ignorelist.c
* Copyright (C) 2006 Lubos Stanek <lubek at users.sourceforge.net>
*
* This program is free software; you can redistribute it and/
struct ignorelist_s
{
int ignore; /* ignore entries */
- int num; /* number of entries */
ignorelist_item_t *head; /* pointer to the first entry */
};
item->next = il->head;
il->head = item;
-
- il->num++;
}
#if HAVE_REGEX_H
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)
{
}
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) */
il->ignore = invert ? 0 : 1;
} /* 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
{
int ret;
size_t entry_len;
- char *entry_copy;
if (il == NULL)
{
/* regex string is enclosed in "/.../" */
if ((entry_len > 2) && (entry[0] == '/') && entry[entry_len - 1] == '/')
{
+ char *entry_copy;
+
/* We need to copy `entry' since it's const */
entry_copy = smalloc (entry_len);
memset (entry_copy, '\0', entry_len);
{
ignorelist_item_t *traverse;
+ assert (il != NULL);
+
/* if no entries, collect all */
- if (ignorelist_num(il) == 0)
+ if (il->head == NULL)
+ return (0);
+
+ if ((entry == NULL) || (strlen (entry) == 0))
return (0);
/* traverse list and check entries */