From: Ruben Kerkhof Date: Fri, 1 Jun 2018 17:02:06 +0000 (+0200) Subject: parser.y: fix implicit conversion warning X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=975e2cad6b848e6ffbc38c71439ff786d87ff4a6;p=collectd.git parser.y: fix implicit conversion warning CC src/liboconfig/liboconfig_la-parser.lo src/liboconfig/parser.y:273:8: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] len = strlen (ret); ~ ^~~~~~~~~~~~ 1 warning generated. --- diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index 90f51de7..0afc9b57 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -265,12 +265,10 @@ static void yyerror(const char *s) static char *unquote (const char *orig) { char *ret = strdup (orig); - int len; - if (ret == NULL) return (NULL); - len = strlen (ret); + size_t len = strlen (ret); if ((len < 2) || (ret[0] != '"') || (ret[len - 1] != '"')) return (ret); @@ -279,7 +277,7 @@ static char *unquote (const char *orig) memmove (ret, ret + 1, len); ret[len] = 0; - for (int i = 0; i < len; i++) + for (size_t i = 0; i < len; i++) { if (ret[i] == '\\') {