basic/list: drop LIST_IS_EMPTY

This was a trivial wrapper that didn't provide any added value. With more
complicated structures like strvs, hashmaps, sets, and arrays, it is possible
to have an empty container. But in case of a list, the list is empty only when
the head is missing.

Also, we generally want the positive condition, so we replace many
if (!LIST_IS_EMPTY(x)) with just if (x).
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-07-02 12:46:16 +02:00
parent a4d60b3e1c
commit 64903d18df
14 changed files with 23 additions and 29 deletions
+4 -4
View File
@@ -1698,16 +1698,16 @@ int bus_exec_context_set_transient_property(
return r;
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
if (LIST_IS_EMPTY(options)) {
c->root_image_options = mount_options_free_all(c->root_image_options);
unit_write_settingf(u, flags, name, "%s=", name);
} else {
if (options) {
LIST_JOIN(mount_options, c->root_image_options, options);
unit_write_settingf(
u, flags|UNIT_ESCAPE_SPECIFIERS, name,
"%s=%s",
name,
format_str);
} else {
c->root_image_options = mount_options_free_all(c->root_image_options);
unit_write_settingf(u, flags, name, "%s=", name);
}
}