projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2199 from jaroug/support_attributes_kairosdb
[collectd.git]
/
src
/
utils_match.c
diff --git
a/src/utils_match.c
b/src/utils_match.c
index
2e487b5
..
e8add2d
100644
(file)
--- a/
src/utils_match.c
+++ b/
src/utils_match.c
@@
-34,6
+34,7
@@
#include <regex.h>
#define UTILS_MATCH_FLAGS_EXCLUDE_REGEX 0x02
#include <regex.h>
#define UTILS_MATCH_FLAGS_EXCLUDE_REGEX 0x02
+#define UTILS_MATCH_FLAGS_REGEX 0x04
struct cu_match_s {
regex_t regex;
struct cu_match_s {
regex_t regex;
@@
-234,6
+235,7
@@
match_create_callback(const char *regex, const char *excluderegex,
sfree(obj);
return (NULL);
}
sfree(obj);
return (NULL);
}
+ obj->flags |= UTILS_MATCH_FLAGS_REGEX;
if (excluderegex && strcmp(excluderegex, "") != 0) {
status = regcomp(&obj->excluderegex, excluderegex, REG_EXTENDED);
if (excluderegex && strcmp(excluderegex, "") != 0) {
status = regcomp(&obj->excluderegex, excluderegex, REG_EXTENDED);
@@
-301,6
+303,10
@@
void match_destroy(cu_match_t *obj) {
if (obj == NULL)
return;
if (obj == NULL)
return;
+ if (obj->flags & UTILS_MATCH_FLAGS_REGEX)
+ regfree(&obj->regex);
+ if (obj->flags & UTILS_MATCH_FLAGS_EXCLUDE_REGEX)
+ regfree(&obj->excluderegex);
if ((obj->user_data != NULL) && (obj->free != NULL))
(*obj->free)(obj->user_data);
if ((obj->user_data != NULL) && (obj->free != NULL))
(*obj->free)(obj->user_data);
@@
-368,5
+374,3
@@
void *match_get_user_data(cu_match_t *obj) {
return (NULL);
return (obj->user_data);
} /* void *match_get_user_data */
return (NULL);
return (obj->user_data);
} /* void *match_get_user_data */
-
-/* vim: set sw=2 sts=2 ts=8 : */