diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-22 16:23:24 -0500 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-07-17 17:58:36 +0200 |
commit | 7e146110e342b54dba8065d850f931025bd4738e (patch) | |
tree | a213b5789ae79ed708252a2414221c55da591bf8 /src/basic | |
parent | f77a1b073bd92fc5ef2bb1cc2328b426598d7929 (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/basic')
-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 c98e956fd..4d3cce826 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -572,9 +572,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. */ @@ -582,9 +579,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) { |