re = calloc(1, sizeof(*re));
if (re == NULL) {
ERROR("ignorelist_append_regex: calloc failed.");
- return (ENOMEM);
+ return ENOMEM;
}
status = regcomp(re, re_str, REG_EXTENDED);
"failed: %s",
re_str, errbuf);
sfree(re);
- return (status);
+ return status;
}
entry = calloc(1, sizeof(*entry));
ERROR("ignorelist_append_regex: calloc failed.");
regfree(re);
sfree(re);
- return (ENOMEM);
+ return ENOMEM;
}
entry->rmatch = re;
ignorelist_append(il, entry);
- return (0);
+ return 0;
} /* int ignorelist_append_regex */
#endif
/* create new entry */
if ((new = calloc(1, sizeof(*new))) == NULL) {
ERROR("cannot allocate new entry");
- return (1);
+ return 1;
}
new->smatch = sstrdup(entry);
/* append new entry */
ignorelist_append(il, new);
- return (0);
+ return 0;
} /* int ignorelist_append_string(ignorelist_t *il, const char *entry) */
#if HAVE_REGEX_H
/* match regex */
if (regexec(item->rmatch, entry, 0, NULL, 0) == 0)
- return (1);
+ return 1;
- return (0);
+ return 0;
} /* int ignorelist_match_regex (ignorelist_item_t *item, const char *entry) */
#endif
(strlen(entry) > 0));
if (strcmp(entry, item->smatch) == 0)
- return (1);
+ return 1;
- return (0);
+ return 0;
} /* int ignorelist_match_string (ignorelist_item_t *item, const char *entry) */
/* *** *** *** ******************************************** *** *** *** */
*/
il->ignore = invert ? 0 : 1;
- return (il);
+ return il;
} /* ignorelist_t *ignorelist_create (int ignore) */
/*
if (il == NULL) {
DEBUG("add called with ignorelist_t == NULL");
- return (1);
+ return 1;
}
len = strlen(entry);
/* append nothing */
if (len == 0) {
DEBUG("not appending: empty entry");
- return (1);
+ return 1;
}
#if HAVE_REGEX_H
int ignorelist_match(ignorelist_t *il, const char *entry) {
/* if no entries, collect all */
if ((il == NULL) || (il->head == NULL))
- return (0);
+ return 0;
if ((entry == NULL) || (strlen(entry) == 0))
- return (0);
+ return 0;
/* traverse list and check entries */
for (ignorelist_item_t *traverse = il->head; traverse != NULL;
#if HAVE_REGEX_H
if (traverse->rmatch != NULL) {
if (ignorelist_match_regex(traverse, entry))
- return (il->ignore);
+ return il->ignore;
} else
#endif
{
if (ignorelist_match_string(traverse, entry))
- return (il->ignore);
+ return il->ignore;
}
} /* for traverse */
- return (1 - il->ignore);
+ return 1 - il->ignore;
} /* int ignorelist_match (ignorelist_t *il, const char *entry) */