From: Sebastian Harl Date: Mon, 16 Feb 2009 11:02:09 +0000 (+0100) Subject: Changed plugin_notification_meta_free()'s argument to a notification_meta_t. X-Git-Tag: collectd-4.6.0~11 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=41503723fc15200eb41ec83b3d9b12b568a917ab;p=collectd.git Changed plugin_notification_meta_free()'s argument to a notification_meta_t. This is more flexible and allows the function to be used when using the meta data without an embedding notification object, e.g. when using the filter chains. --- diff --git a/src/exec.c b/src/exec.c index 8add480e..973cd52b 100644 --- a/src/exec.c +++ b/src/exec.c @@ -712,7 +712,8 @@ static void *exec_notification_one (void *arg) /* {{{ */ DEBUG ("exec plugin: Child %i exited with status %i.", pid, status); - plugin_notification_meta_free (n); + plugin_notification_meta_free (n->meta); + n->meta = NULL; sfree (arg); pthread_exit ((void *) 0); return (NULL); diff --git a/src/perl.c b/src/perl.c index efb8bdd6..f9c99387 100644 --- a/src/perl.c +++ b/src/perl.c @@ -529,7 +529,8 @@ static int hv2notification (pTHX_ HV *hash, notification_t *n) } if (0 != av2notification_meta (aTHX_ (AV *)SvRV (*tmp), &n->meta)) { - plugin_notification_meta_free (n); + plugin_notification_meta_free (n->meta); + n->meta = NULL; return -1; } break; @@ -925,7 +926,7 @@ static int pplugin_dispatch_notification (pTHX_ HV *notif) return -1; ret = plugin_dispatch_notification (&n); - plugin_notification_meta_free (&n); + plugin_notification_meta_free (n.meta); return ret; } /* static int pplugin_dispatch_notification (HV *) */ diff --git a/src/plugin.c b/src/plugin.c index 61cc09c6..9f42f2e4 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1154,7 +1154,7 @@ int plugin_notification_meta_copy (notification_t *dst, return (0); } /* int plugin_notification_meta_copy */ -int plugin_notification_meta_free (notification_t *n) +int plugin_notification_meta_free (notification_meta_t *n) { notification_meta_t *this; notification_meta_t *next; @@ -1165,8 +1165,7 @@ int plugin_notification_meta_free (notification_t *n) return (-1); } - this = n->meta; - n->meta = NULL; + this = n; while (this != NULL) { next = this->next; diff --git a/src/plugin.h b/src/plugin.h index 2d993017..3088e06e 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -301,6 +301,6 @@ int plugin_notification_meta_add_boolean (notification_t *n, int plugin_notification_meta_copy (notification_t *dst, const notification_t *src); -int plugin_notification_meta_free (notification_t *n); +int plugin_notification_meta_free (notification_meta_t *n); #endif /* PLUGIN_H */ diff --git a/src/utils_threshold.c b/src/utils_threshold.c index 1b211385..03a3f2d4 100644 --- a/src/utils_threshold.c +++ b/src/utils_threshold.c @@ -674,7 +674,7 @@ static int ut_report_state (const data_set_t *ds, plugin_dispatch_notification (&n); - plugin_notification_meta_free (&n); + plugin_notification_meta_free (n.meta); return (0); } /* }}} int ut_report_state */