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]
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2011-04-26 21:23:56 +02:00 committed by Lennart Poettering
parent 016e9849e0
commit aa4355f295

View file

@ -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;