X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectd-nagios.c;h=33580f9e4758cc990ba6bf12e8eccdbfcf2e13bd;hb=ec6deefb347fad727b293995e8d3341a898c9812;hp=89f73b8335ee7dd6cb349b57f7cc8ead574671e7;hpb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;p=collectd.git diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index 89f73b83..33580f9e 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -93,17 +94,17 @@ typedef struct range_s range_t; extern char *optarg; extern int optind, opterr, optopt; -static char *socket_file_g = NULL; -static char *value_string_g = NULL; -static char *hostname_g = NULL; +static char *socket_file_g; +static char *value_string_g; +static char *hostname_g; static range_t range_critical_g; static range_t range_warning_g; static int consolitation_g = CON_NONE; -static _Bool nan_is_error_g = 0; +static bool nan_is_error_g; -static char **match_ds_g = NULL; -static size_t match_ds_num_g = 0; +static char **match_ds_g; +static size_t match_ds_num_g; /* `strdup' is an XSI extension. I don't want to pull in all of XSI just for * that, so here's an own implementation.. It's easy enough. The GCC attributes @@ -115,7 +116,7 @@ cn_strdup(const char *str) /* {{{ */ char *ret; strsize = strlen(str) + 1; - ret = (char *)malloc(strsize); + ret = malloc(strsize); if (ret != NULL) memcpy(ret, str, strsize); return ret; @@ -129,13 +130,13 @@ static int filter_ds(size_t *values_num, double **values, if (match_ds_g == NULL) return RET_OKAY; - new_values = (gauge_t *)calloc(match_ds_num_g, sizeof(*new_values)); + new_values = calloc(match_ds_num_g, sizeof(*new_values)); if (new_values == NULL) { fprintf(stderr, "calloc failed: %s\n", strerror(errno)); return RET_UNKNOWN; } - new_names = (char **)calloc(match_ds_num_g, sizeof(*new_names)); + new_names = calloc(match_ds_num_g, sizeof(*new_names)); if (new_names == NULL) { fprintf(stderr, "calloc failed: %s\n", strerror(errno)); free(new_values); @@ -637,7 +638,7 @@ int main(int argc, char **argv) { break; } case 'm': - nan_is_error_g = 1; + nan_is_error_g = true; break; default: usage(argv[0]);