From: Florian Forster Date: Sat, 22 Nov 2008 00:03:25 +0000 (+0100) Subject: src/filter_chain.c: Allow the create-function of mathces to be NULL. X-Git-Tag: collectd-4.6.0~156^2~2 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=a810982081c5b22df61c888355c50ca388fa2a84;p=collectd.git src/filter_chain.c: Allow the create-function of mathces to be NULL. Not all targets actually need to be created, for example the `stop' target. --- diff --git a/src/filter_chain.c b/src/filter_chain.c index 57844260..154a4abe 100644 --- a/src/filter_chain.c +++ b/src/filter_chain.c @@ -340,17 +340,23 @@ static int fc_config_add_target (fc_target_t **targets_head, /* {{{ */ sstrncpy (t->name, ptr->name, sizeof (t->name)); memcpy (&t->proc, &ptr->proc, sizeof (t->proc)); - assert (t->proc.create != NULL); t->user_data = NULL; t->next = NULL; - status = (*t->proc.create) (ci, &t->user_data); - if (status != 0) + if (t->proc.create != NULL) { - WARNING ("Filter subsystem: Failed to create a %s match.", - t->name); - fc_free_targets (t); - return (-1); + status = (*t->proc.create) (ci, &t->user_data); + if (status != 0) + { + WARNING ("Filter subsystem: Failed to create a %s match.", + t->name); + fc_free_targets (t); + return (-1); + } + } + else + { + t->user_data = NULL; } if (*targets_head != NULL)