X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fcollectd-nagios.c;h=06298494550f8bbf56a1433bb970b0fe73a2a4f1;hp=54be36aaee3363d8217594c40b033e98430ecc9e;hb=48efd3deb4c9139fd060ff3d289896e9031bcc7c;hpb=614660f40c32b5af9b6c4852e4e370fc3953a5c8 diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index 54be36aa..06298494 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -116,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; @@ -130,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); @@ -527,7 +527,7 @@ static int do_check(lcc_connection_t *connection) { int status; snprintf(ident_str, sizeof(ident_str), "%s/%s", hostname_g, value_string_g); - ident_str[sizeof(ident_str) - 1] = 0; + ident_str[sizeof(ident_str) - 1] = '\0'; status = lcc_string_to_identifier(connection, &ident, ident_str); if (status != 0) { @@ -652,7 +652,7 @@ int main(int argc, char **argv) { } snprintf(address, sizeof(address), "unix:%s", socket_file_g); - address[sizeof(address) - 1] = 0; + address[sizeof(address) - 1] = '\0'; connection = NULL; status = lcc_connect(address, &connection);