From: Florian Forster Date: Wed, 8 Jul 2015 10:39:56 +0000 (+0200) Subject: oconfig: Fix -Wshadow and -Wsign-compare warnings. X-Git-Tag: collectd-5.6.0~645 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=21b0365e24e1e7bd56ec27c5b539e9b5779d19b5;p=collectd.git oconfig: Fix -Wshadow and -Wsign-compare warnings. Also re-indent oconfig_clone(). --- diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index ba93062c..d01c79dd 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -53,11 +53,9 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh) yyset_in (fh); if (NULL == c_file) { - int status; - status = snprintf (file, sizeof (file), "", fileno (fh)); - if ((status < 0) || (status >= sizeof (file))) { + if ((status < 0) || (((size_t) status) >= sizeof (file))) { c_file = ""; } else { @@ -147,18 +145,17 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) ci_copy->values[i].type = ci_orig->values[i].type; if (ci_copy->values[i].type == OCONFIG_TYPE_STRING) { - ci_copy->values[i].value.string - = strdup (ci_orig->values[i].value.string); - if (ci_copy->values[i].value.string == NULL) - { - fprintf (stderr, "strdup failed.\n"); - oconfig_free (ci_copy); - return (NULL); - } + ci_copy->values[i].value.string = strdup (ci_orig->values[i].value.string); + if (ci_copy->values[i].value.string == NULL) + { + fprintf (stderr, "strdup failed.\n"); + oconfig_free (ci_copy); + return (NULL); + } } else /* ci_copy->values[i].type != OCONFIG_TYPE_STRING) */ { - ci_copy->values[i].value = ci_orig->values[i].value; + ci_copy->values[i].value = ci_orig->values[i].value; } } } /* }}} if (ci_orig->values_num > 0) */