[systemd-devel] [PATCH] Fix gcc unitialized variable warning
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Apr 24 10:29:17 PDT 2011
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 files changed, 2 insertions(+), 2 deletions(-)
diff --git src/strv.c src/strv.c
index 71b77c9..f15aa87 100644
--- src/strv.c
+++ 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;
--
1.7.4.1
More information about the systemd-devel
mailing list