From 18f71a3c8174774c5386c4aba94d54f3b5c36a84 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 22 Jan 2017 16:23:24 -0500 Subject: basic/strv: allow NULLs to be inserted into strv All callers of this function insert non-empty strings, so there's no functional change. --- src/basic/strv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/basic') diff --git a/src/basic/strv.c b/src/basic/strv.c index 0eec868eed..60f92e6373 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -564,9 +564,6 @@ 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. */ @@ -574,9 +571,12 @@ int strv_extend_front(char ***l, const char *value) { if (m < n) return -ENOMEM; - v = strdup(value); - if (!v) - return -ENOMEM; + if (value) { + v = strdup(value); + if (!v) + return -ENOMEM; + } else + v = NULL; c = realloc_multiply(*l, sizeof(char*), m); if (!c) { -- cgit v1.2.3-54-g00ecf