From: Zbigniew Jędrzejewski-Szmek Date: Tue, 26 Apr 2011 19:23:56 +0000 (+0200) Subject: strv: Fix gcc unitialized variable warning X-Git-Tag: v26~20 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa4355f295c76704baec08509e80fcb827c023da;p=systemd strv: Fix gcc unitialized variable warning Since strv_* functions handle null arguments, this warning is actually valid. src/strv.c: In function ‘strv_copy’: src/strv.c:68:21: warning: ‘k’ may be used uninitialized in this function [-Wuninitialized] --- diff --git a/src/strv.c b/src/strv.c index 71b77c9b..f15aa873 100644 --- a/src/strv.c +++ b/src/strv.c @@ -67,11 +67,11 @@ void strv_free(char **l) { char **strv_copy(char **l) { char **r, **k; - if (!(r = new(char*, strv_length(l)+1))) + if (!(k = r = new(char*, strv_length(l)+1))) return NULL; if (l) - for (k = r; *l; k++, l++) + for (; *l; k++, l++) if (!(*k = strdup(*l))) goto fail;