From a810982081c5b22df61c888355c50ca388fa2a84 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 22 Nov 2008 01:03:25 +0100 Subject: [PATCH] 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. --- src/filter_chain.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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) -- 2.30.2