X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ffilter_chain.c;h=903f66f912d60087dd56b35458bb3b7bc58c3114;hb=9fd3d670c4e85d840e618647c15b64d728a3f193;hp=5ad9655c9a355f53d80865db99de55f0528273ee;hpb=ef4a3db895a0aba7107c0f1c6c2ef2a7f128aaf8;p=collectd.git diff --git a/src/filter_chain.c b/src/filter_chain.c index 5ad9655c..903f66f9 100644 --- a/src/filter_chain.c +++ b/src/filter_chain.c @@ -387,7 +387,6 @@ static int fc_config_add_rule (fc_chain_t *chain, /* {{{ */ for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Match", option->key) == 0) status = fc_config_add_match (&rule->matches, option); @@ -471,7 +470,6 @@ static int fc_config_add_chain (const oconfig_item_t *ci) /* {{{ */ for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Rule", option->key) == 0) status = fc_config_add_rule (chain, option); @@ -884,17 +882,17 @@ int fc_process_chain (const data_set_t *ds, value_list_t *vl, /* {{{ */ { fc_rule_t *rule; fc_target_t *target; - int status; + int status = FC_TARGET_CONTINUE; if (chain == NULL) return (-1); DEBUG ("fc_process_chain (chain = %s);", chain->name); - status = FC_TARGET_CONTINUE; for (rule = chain->rules; rule != NULL; rule = rule->next) { fc_match_t *match; + status = FC_TARGET_CONTINUE; if (rule->name[0] != 0) { @@ -956,8 +954,7 @@ int fc_process_chain (const data_set_t *ds, value_list_t *vl, /* {{{ */ } } - if ((status == FC_TARGET_STOP) - || (status == FC_TARGET_RETURN)) + if ((status == FC_TARGET_STOP) || (status == FC_TARGET_RETURN)) { if (rule->name[0] != 0) { @@ -968,20 +965,10 @@ int fc_process_chain (const data_set_t *ds, value_list_t *vl, /* {{{ */ } break; } - else - { - status = FC_TARGET_CONTINUE; - } } /* for (rule) */ - if (status == FC_TARGET_STOP) - return (FC_TARGET_STOP); - else if (status == FC_TARGET_RETURN) - return (FC_TARGET_CONTINUE); - - /* for-loop has been aborted: A target returned `FC_TARGET_STOP' */ - if (rule != NULL) - return (FC_TARGET_CONTINUE); + if ((status == FC_TARGET_STOP) || (status == FC_TARGET_RETURN)) + return (status); DEBUG ("fc_process_chain (%s): Executing the default targets.", chain->name);