diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-22 16:23:24 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-11 18:21:06 -0500 |
commit | 18f71a3c8174774c5386c4aba94d54f3b5c36a84 (patch) | |
tree | de86dc04d50621d6f962b1f3341f2e7ade50743d /src | |
parent | 58f88d929f2b46e9470eb468f4890c1d4e8f51b7 (diff) |
basic/strv: allow NULLs to be inserted into strv
All callers of this function insert non-empty strings, so there's no functional
change.
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/strv.c | 12 |
1 files changed, 6 insertions, 6 deletions
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) { |