From 620ba7b575a4d2a9c8c997a240d178980b39276f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 13 Jun 2008 14:57:10 +0200 Subject: [PATCH] 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. --- src/plugin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- 2.11.0