X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Faggregation.c;h=a80219965192f1065eed0d7813fc0210dfd31e3b;hp=64c641f84570dd12990f3bc3cdfd1589e2eefd61;hb=d486225f89ea52d8ed2b4242eba2ad94c409f837;hpb=029b489b237a8785c539f85d4840a49ba6743603 diff --git a/src/aggregation.c b/src/aggregation.c index 64c641f8..a8021996 100644 --- a/src/aggregation.c +++ b/src/aggregation.c @@ -83,24 +83,24 @@ struct agg_instance_s /* {{{ */ agg_instance_t *next; }; /* }}} */ -static lookup_t *lookup = NULL; +static lookup_t *lookup; static pthread_mutex_t agg_instance_list_lock = PTHREAD_MUTEX_INITIALIZER; -static agg_instance_t *agg_instance_list_head = NULL; +static agg_instance_t *agg_instance_list_head; static bool agg_is_regex(char const *str) /* {{{ */ { if (str == NULL) - return 0; + return false; size_t len = strlen(str); if (len < 3) - return 0; + return false; if ((str[0] == '/') && (str[len - 1] == '/')) - return 1; + return true; else - return 0; + return false; } /* }}} bool agg_is_regex */ static void agg_destroy(aggregation_t *agg) /* {{{ */ @@ -571,7 +571,7 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ agg->regex_fields |= LU_GROUP_BY_TYPE_INSTANCE; /* Sanity checking */ - bool is_valid = 1; + bool is_valid = true; if (strcmp("/.*/", agg->ident.type) == 0) /* {{{ */ { ERROR("aggregation plugin: It appears you did not specify the required " @@ -580,13 +580,13 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ "Type \"%s\", TypeInstance \"%s\")", agg->ident.host, agg->ident.plugin, agg->ident.plugin_instance, agg->ident.type, agg->ident.type_instance); - is_valid = 0; + is_valid = false; } else if (strchr(agg->ident.type, '/') != NULL) { ERROR("aggregation plugin: The \"Type\" may not contain the '/' " "character. Especially, it may not be a regex. The current " "value is \"%s\".", agg->ident.type); - is_valid = 0; + is_valid = false; } /* }}} */ /* Check that there is at least one regex field without a grouping. {{{ */ @@ -599,7 +599,7 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ "Type \"%s\", TypeInstance \"%s\")", agg->ident.host, agg->ident.plugin, agg->ident.plugin_instance, agg->ident.type, agg->ident.type_instance); - is_valid = 0; + is_valid = false; } /* }}} */ /* Check that all grouping fields are regular expressions. {{{ */ @@ -611,7 +611,7 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ "Type \"%s\", TypeInstance \"%s\")", agg->ident.host, agg->ident.plugin, agg->ident.plugin_instance, agg->ident.type, agg->ident.type_instance); - is_valid = 0; + is_valid = false; } /* }}} */ if (!agg->calc_num && !agg->calc_sum && !agg->calc_average /* {{{ */ @@ -622,7 +622,7 @@ static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ "Type \"%s\", TypeInstance \"%s\")", agg->ident.host, agg->ident.plugin, agg->ident.plugin_instance, agg->ident.type, agg->ident.type_instance); - is_valid = 0; + is_valid = false; } /* }}} */ if (!is_valid) { /* {{{ */ @@ -712,7 +712,7 @@ static int agg_read(void) /* {{{ */ static int agg_write(data_set_t const *ds, value_list_t const *vl, /* {{{ */ __attribute__((unused)) user_data_t *user_data) { - bool created_by_aggregation = 0; + bool created_by_aggregation = false; /* Ignore values that were created by the aggregation plugin to avoid weird * effects. */ (void)meta_data_get_boolean(vl->meta, "aggregation:created",