From: Florian Forster Date: Fri, 13 Jun 2008 12:57:10 +0000 (+0200) Subject: src/plugin.c: Add assertions to detect if two linked lists are the same. X-Git-Tag: collectd-4.5.0~117^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=620ba7b575a4d2a9c8c997a240d178980b39276f;p=collectd.git src/plugin.c: Add assertions to detect if two linked lists are the same. This will catch errors as just fixed in the exec plugin in the future. --- diff --git a/src/plugin.c b/src/plugin.c index 77041c9e..2d431db3 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -923,7 +923,6 @@ static int plugin_notification_meta_add (notification_t *n, sstrncpy (meta->name, name, sizeof (meta->name)); meta->type = type; - meta->next = NULL; switch (type) { @@ -966,6 +965,7 @@ static int plugin_notification_meta_add (notification_t *n, } } /* switch (type) */ + meta->next = NULL; tail = n->meta; while ((tail != NULL) && (tail->next != NULL)) tail = tail->next; @@ -1018,6 +1018,11 @@ int plugin_notification_meta_copy (notification_t *dst, { notification_meta_t *meta; + assert (dst != NULL); + assert (src != NULL); + assert (dst != src); + assert ((src->meta == NULL) || (src->meta != dst->meta)); + for (meta = src->meta; meta != NULL; meta = meta->next) { if (meta->type == NM_TYPE_STRING)