string-util: imply NULL termination of strextend() argument list

The trailing NULL in the argument list is now implied (similar to
what we already have in place in strjoin()).
This commit is contained in:
Lennart Poettering
2021-01-06 17:24:46 +01:00
parent 0ec1dc5ba3
commit c2bc710b24
23 changed files with 61 additions and 63 deletions
+1 -1
View File
@@ -1159,7 +1159,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
if (r < 0)
return log_error_errno(r, "Failed to unescape text '%s': %m", eq);
if (!strextend(&unescaped, "\n", NULL))
if (!strextend(&unescaped, "\n"))
return log_oom();
/* Note that we don't expand specifiers here, but that should be OK, as this is a programmatic
+1 -1
View File
@@ -343,7 +343,7 @@ int config_parse(
return -ENOBUFS;
}
if (!strextend(&continuation, l, NULL)) {
if (!strextend(&continuation, l)) {
if (flags & CONFIG_PARSE_WARN)
log_oom();
return -ENOMEM;
+2 -2
View File
@@ -1340,12 +1340,12 @@ static int mount_partition(
if (asprintf(&uid_option, "uid=" UID_FMT ",gid=" GID_FMT, uid_shift, (gid_t) uid_shift) < 0)
return -ENOMEM;
if (!strextend_with_separator(&options, ",", uid_option, NULL))
if (!strextend_with_separator(&options, ",", uid_option))
return -ENOMEM;
}
if (!isempty(m->mount_options))
if (!strextend_with_separator(&options, ",", m->mount_options, NULL))
if (!strextend_with_separator(&options, ",", m->mount_options))
return -ENOMEM;
if (FLAGS_SET(flags, DISSECT_IMAGE_MKDIR)) {
+1 -1
View File
@@ -733,7 +733,7 @@ int mount_option_mangle(
}
/* If 'word' is not a mount flag, then store it in '*ret_remaining_options'. */
if (!ent->name && !strextend_with_separator(&ret, ",", word, NULL))
if (!ent->name && !strextend_with_separator(&ret, ",", word))
return -ENOMEM;
}
+1 -1
View File
@@ -61,7 +61,7 @@ int namespace_flags_to_string(unsigned long flags, char **ret) {
if ((flags & namespace_flag_map[i].flag) != namespace_flag_map[i].flag)
continue;
if (!strextend_with_separator(&s, " ", namespace_flag_map[i].name, NULL))
if (!strextend_with_separator(&s, " ", namespace_flag_map[i].name))
return -ENOMEM;
}