From: Florian Forster Date: Mon, 31 Oct 2016 15:57:40 +0000 (+0100) Subject: src/daemon/utils_match.c: Improve readability of reset logic. X-Git-Tag: collectd-5.7.0~40 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d7ad0d6a5533eacd589a1293f19905d8eeabbf39;p=collectd.git src/daemon/utils_match.c: Improve readability of reset logic. --- diff --git a/src/daemon/utils_match.c b/src/daemon/utils_match.c index 31ee6df2..39f70433 100644 --- a/src/daemon/utils_match.c +++ b/src/daemon/utils_match.c @@ -295,13 +295,16 @@ cu_match_t *match_create_simple (const char *regex, void match_value_reset (cu_match_value_t *mv) { - if ((mv == NULL) - || ((mv->ds_type & UTILS_MATCH_DS_TYPE_GAUGE) == 0) - || ((mv->ds_type & UTILS_MATCH_CF_GAUGE_PERSIST) != 0)) + if (mv == NULL) return; - mv->value.gauge = NAN; - mv->values_num = 0; + /* Reset GAUGE metrics only and except GAUGE_PERSIST. */ + if ((mv->ds_type & UTILS_MATCH_DS_TYPE_GAUGE) + && !(mv->ds_type & UTILS_MATCH_CF_GAUGE_PERSIST)) + { + mv->value.gauge = NAN; + mv->values_num = 0; + } } /* }}} void match_value_reset */ void match_destroy (cu_match_t *obj)