From 21b0365e24e1e7bd56ec27c5b539e9b5779d19b5 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 8 Jul 2015 12:39:56 +0200 Subject: [PATCH] oconfig: Fix -Wshadow and -Wsign-compare warnings. Also re-indent oconfig_clone(). --- src/liboconfig/oconfig.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) 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) */ -- 2.30.2