strv: make iterator in STRV_FOREACH() declaread in the loop

This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
This commit is contained in:
Yu Watanabe
2022-03-19 08:33:33 +09:00
parent 80a226b26b
commit de010b0b2e
210 changed files with 109 additions and 621 deletions
-1
View File
@@ -200,7 +200,6 @@ int bind_user_prepare(
_cleanup_(bind_user_context_freep) BindUserContext *c = NULL;
uid_t current_uid = MAP_UID_MIN;
char **n;
int r;
assert(custom_mounts);
-4
View File
@@ -166,8 +166,6 @@ int custom_mount_prepare_all(const char *dest, CustomMount *l, size_t n) {
}
if (m->type == CUSTOM_MOUNT_OVERLAY) {
char **j;
STRV_FOREACH(j, m->lower) {
char *s;
@@ -319,8 +317,6 @@ int overlay_mount_parse(CustomMount **l, size_t *n, const char *s, bool read_onl
if (!destination)
return -ENOMEM;
} else {
char **i;
/* If more than two parameters are specified, the last one is the destination, the second to last one
* the "upper", and all before that the "lower" directories. */
-5
View File
@@ -288,7 +288,6 @@ int setup_veth_extra(
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
uint64_t idx = 0;
char **a, **b;
int r;
assert(machine_name);
@@ -495,7 +494,6 @@ int test_network_interface_initialized(const char *name) {
int move_network_interfaces(int netns_fd, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
char **i;
int r;
if (strv_isempty(ifaces))
@@ -532,7 +530,6 @@ int move_network_interfaces(int netns_fd, char **ifaces) {
int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
unsigned idx = 0;
char **i;
int r;
if (strv_isempty(ifaces))
@@ -619,7 +616,6 @@ int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
int setup_ipvlan(const char *machine_name, pid_t pid, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
char **i;
int r;
if (strv_isempty(ifaces))
@@ -728,7 +724,6 @@ int veth_extra_parse(char ***l, const char *p) {
int remove_veth_links(const char *primary, char **pairs) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
char **a, **b;
int r;
/* In some cases the kernel might pin the veth links between host and container even after the namespace
-1
View File
@@ -1892,7 +1892,6 @@ static int oci_seccomp_syscalls(const char *name, JsonVariant *v, JsonDispatchFl
struct syscall_rule rule = {
.action = UINT32_MAX,
};
char **i;
r = json_dispatch(e, table, oci_unexpected, flags, &rule);
if (r < 0)
-1
View File
@@ -140,7 +140,6 @@ static int add_syscall_filters(
};
_cleanup_strv_free_ char **added = NULL;
char **p;
int r;
for (size_t i = 0; i < ELEMENTSOF(allow_list); i++) {
-1
View File
@@ -3149,7 +3149,6 @@ static int patch_sysctl(void) {
};
unsigned long flags;
char **k, **v;
int r;
flags = effective_clone_ns_flags();