chiark / gitweb /
Revert "basic/strv: allow NULLs to be inserted into strv"
[elogind.git] / src / basic / strv.c
index 4d3cce8260c3d78272f983fc9d61a2fc0c0af03d..c98e956fd92ce7be1cfa5a8e55e0276f77f59163 100644 (file)
@@ -572,6 +572,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. */
@@ -579,12 +582,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) {