From aa4355f295c76704baec08509e80fcb827c023da Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 26 Apr 2011 21:23:56 +0200 Subject: [PATCH] strv: Fix gcc unitialized variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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] --- src/strv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.39.5