X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_match.c;h=bb53a9a317bd79b718e26f7262c49ea2268ccd93;hb=82e27678f8972d2625b466e7e7ba9daaa6395c98;hp=4d4b57d08051b31e91dceb0a8bf43a4e67695dfe;hpb=b53110ef99e3d6a5e2f8e79b8f068cfe96a1accb;p=collectd.git diff --git a/src/utils_match.c b/src/utils_match.c index 4d4b57d0..bb53a9a3 100644 --- a/src/utils_match.c +++ b/src/utils_match.c @@ -1,6 +1,6 @@ /** * collectd - src/utils_match.c - * Copyright (C) 2008 Florian octo Forster + * Copyright (C) 2008-2014 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -228,7 +228,7 @@ cu_match_t *match_create_callback (const char *regex, const char *excluderegex, return (NULL); memset (obj, '\0', sizeof (cu_match_t)); - status = regcomp (&obj->regex, regex, REG_EXTENDED); + status = regcomp (&obj->regex, regex, REG_EXTENDED | REG_NEWLINE); if (status != 0) { ERROR ("Compiling the regular expression \"%s\" failed.", regex); @@ -279,6 +279,18 @@ cu_match_t *match_create_simple (const char *regex, return (obj); } /* cu_match_t *match_create_simple */ +void match_value_reset (cu_match_value_t *mv) +{ + if (mv == NULL) + return; + + if (mv->ds_type & UTILS_MATCH_DS_TYPE_GAUGE) + { + mv->value.gauge = NAN; + mv->values_num = 0; + } +} /* }}} void match_value_reset */ + void match_destroy (cu_match_t *obj) { if (obj == NULL)