#include "collectd.h"
+
#include <pthread.h>
#include <regex.h>
struct user_obj_s
{
void *user_obj;
- identifier_t ident;
+ lookup_identifier_t ident;
user_obj_t *next;
};
} /* }}} int lu_copy_ident_to_match_part */
static int lu_copy_ident_to_match (identifier_match_t *match, /* {{{ */
- identifier_t const *ident, unsigned int group_by)
+ lookup_identifier_t const *ident, unsigned int group_by)
{
memset (match, 0, sizeof (*match));
}
by_type->wildcard_plugin_list = NULL;
- by_type->by_plugin_tree = c_avl_create ((void *) strcmp);
+ by_type->by_plugin_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
if (by_type->by_plugin_tree == NULL)
{
ERROR ("utils_vl_lookup: c_avl_create failed.");
obj->cb_free_class (user_class_list->entry.user_class);
user_class_list->entry.user_class = NULL;
+#define CLEAR_FIELD(field) do { \
+ if (user_class_list->entry.match.field.is_regex) { \
+ regfree (&user_class_list->entry.match.field.regex); \
+ user_class_list->entry.match.field.is_regex = 0; \
+ } \
+} while (0)
+
+ CLEAR_FIELD (host);
+ CLEAR_FIELD (plugin);
+ CLEAR_FIELD (plugin_instance);
+ CLEAR_FIELD (type);
+ CLEAR_FIELD (type_instance);
+
+#undef CLEAR_FIELD
+
lu_destroy_user_obj (obj, user_class_list->entry.user_obj_list);
user_class_list->entry.user_obj_list = NULL;
pthread_mutex_destroy (&user_class_list->entry.lock);
return (NULL);
}
- obj->by_type_tree = c_avl_create ((void *) strcmp);
+ obj->by_type_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
if (obj->by_type_tree == NULL)
{
ERROR ("utils_vl_lookup: c_avl_create failed.");
} /* }}} void lookup_destroy */
int lookup_add (lookup_t *obj, /* {{{ */
- identifier_t const *ident, unsigned int group_by, void *user_class)
+ lookup_identifier_t const *ident, unsigned int group_by, void *user_class)
{
by_type_entry_t *by_type = NULL;
user_class_list_t *user_class_obj;