mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 18:55:40 +03:00
basic/strv: allow NULLs to be inserted into strv
All callers of this function insert non-empty strings, so there's no functional change.
This commit is contained in:
parent
58f88d929f
commit
18f71a3c81
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user