From: Sebastian Harl Date: Mon, 16 Feb 2009 14:16:48 +0000 (+0100) Subject: src/filter_chain.c: Made match_proc_t.create optional. X-Git-Tag: collectd-4.6.0~7 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ddced90c76fb00e2141478a3573c42b72a526fe6;p=collectd.git src/filter_chain.c: Made match_proc_t.create optional. In most cases it does not make sense to not provide a create callback. However, we never know what the future might bring, so let's chose the more flexible approach. --- diff --git a/src/filter_chain.c b/src/filter_chain.c index 70a37bf6..9a52f7c9 100644 --- a/src/filter_chain.c +++ b/src/filter_chain.c @@ -268,19 +268,21 @@ static int fc_config_add_match (fc_match_t **matches_head, /* {{{ */ sstrncpy (m->name, ptr->name, sizeof (m->name)); memcpy (&m->proc, &ptr->proc, sizeof (m->proc)); - assert (m->proc.create != NULL); m->user_data = NULL; m->next = NULL; - status = (*m->proc.create) (ci, &m->user_data); - if (status != 0) + if (m->proc.create != NULL) { - WARNING ("Filter subsystem: Failed to create a %s match.", - m->name); - fc_free_matches (m); - return (-1); + status = (*m->proc.create) (ci, &m->user_data); + if (status != 0) + { + WARNING ("Filter subsystem: Failed to create a %s match.", + m->name); + fc_free_matches (m); + return (-1); + } } - + if (*matches_head != NULL) { ptr = *matches_head;