Revert "basic/strv: allow NULLs to be inserted into strv"
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Feb 2017 17:11:12 +0000 (18:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Feb 2017 20:55:44 +0000 (21:55 +0100)
This reverts commit 18f71a3c8174774c5386c4aba94d54f3b5c36a84.

According to @keszybz we don't need this anymore, hence drop it:

https://github.com/systemd/systemd/pull/5131/commits/18f71a3c8174774c5386c4aba94d54f3b5c36a84#r102232368

src/basic/strv.c

index 60f92e6..0eec868 100644 (file)
@@ -564,6 +564,9 @@ int strv_extend_front(char ***l, const char *value) {
 
         /* Like strv_extend(), but prepends rather than appends the new entry */
 
+        if (!value)
+                return 0;
+
         n = strv_length(*l);
 
         /* Increase and overflow check. */
@@ -571,12 +574,9 @@ int strv_extend_front(char ***l, const char *value) {
         if (m < n)
                 return -ENOMEM;
 
-        if (value) {
-                v = strdup(value);
-                if (!v)
-                        return -ENOMEM;
-        } else
-                v = NULL;
+        v = strdup(value);
+        if (!v)
+                return -ENOMEM;
 
         c = realloc_multiply(*l, sizeof(char*), m);
         if (!c) {