summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-08 11:58:29 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-08 12:14:05 +0200
commit90e74a66e663f1776457d599cb7d5ce44785a56c (patch)
tree16ce28594b8dc475e37df9a3b80accb96e748efa /src/core
parentcore/unit: reduce scope of variables (diff)
downloadsystemd-90e74a66e663f1776457d599cb7d5ce44785a56c.tar.xz
systemd-90e74a66e663f1776457d599cb7d5ce44785a56c.zip
tree-wide: define iterator inside of the macro
Diffstat (limited to 'src/core')
-rw-r--r--src/core/automount.c5
-rw-r--r--src/core/bpf-firewall.c3
-rw-r--r--src/core/cgroup.c18
-rw-r--r--src/core/core-varlink.c6
-rw-r--r--src/core/dbus-execute.c12
-rw-r--r--src/core/dbus-job.c3
-rw-r--r--src/core/dbus-manager.c12
-rw-r--r--src/core/dbus-service.c5
-rw-r--r--src/core/dbus-unit.c12
-rw-r--r--src/core/dbus.c22
-rw-r--r--src/core/device.c3
-rw-r--r--src/core/dynamic-user.c6
-rw-r--r--src/core/execute.c15
-rw-r--r--src/core/job.c28
-rw-r--r--src/core/killall.c6
-rw-r--r--src/core/manager.c45
-rw-r--r--src/core/mount.c6
-rw-r--r--src/core/service.c3
-rw-r--r--src/core/slice.c6
-rw-r--r--src/core/socket.c6
-rw-r--r--src/core/target.c3
-rw-r--r--src/core/transaction.c59
-rw-r--r--src/core/unit.c65
23 files changed, 125 insertions, 224 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index def267ddb7..782f7680aa 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -850,7 +850,6 @@ static int automount_stop(Unit *u) {
static int automount_serialize(Unit *u, FILE *f, FDSet *fds) {
Automount *a = AUTOMOUNT(u);
- Iterator i;
void *p;
int r;
@@ -862,9 +861,9 @@ static int automount_serialize(Unit *u, FILE *f, FDSet *fds) {
(void) serialize_item(f, "result", automount_result_to_string(a->result));
(void) serialize_item_format(f, "dev-id", "%lu", (unsigned long) a->dev_id);
- SET_FOREACH(p, a->tokens, i)
+ SET_FOREACH(p, a->tokens)
(void) serialize_item_format(f, "token", "%u", PTR_TO_UINT(p));
- SET_FOREACH(p, a->expire_tokens, i)
+ SET_FOREACH(p, a->expire_tokens)
(void) serialize_item_format(f, "expire-token", "%u", PTR_TO_UINT(p));
r = serialize_fd(f, fds, "pipe-fd", a->pipe_fd);
diff --git a/src/core/bpf-firewall.c b/src/core/bpf-firewall.c
index bceb049b58..5671d0c195 100644
--- a/src/core/bpf-firewall.c
+++ b/src/core/bpf-firewall.c
@@ -646,14 +646,13 @@ int bpf_firewall_load_custom(Unit *u) {
static int attach_custom_bpf_progs(Unit *u, const char *path, int attach_type, Set **set, Set **set_installed) {
BPFProgram *prog;
- Iterator i;
int r;
assert(u);
set_clear(*set_installed);
- SET_FOREACH(prog, *set, i) {
+ SET_FOREACH(prog, *set) {
r = bpf_program_cgroup_attach(prog, attach_type, path, BPF_F_ALLOW_MULTI);
if (r < 0)
return log_unit_error_errno(u, r, "Attaching custom egress BPF program to cgroup %s failed: %m", path);
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index a6a9e0c7d4..6af08e78e6 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1516,9 +1516,8 @@ CGroupMask unit_get_members_mask(Unit *u) {
if (u->type == UNIT_SLICE) {
void *v;
Unit *member;
- Iterator i;
- HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE], i)
+ HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE])
if (UNIT_DEREF(member->slice) == u)
u->cgroup_members_mask |= unit_get_subtree_mask(member); /* note that this calls ourselves again, for the children */
}
@@ -1940,7 +1939,6 @@ static int unit_attach_pid_to_cgroup_via_bus(Unit *u, pid_t pid, const char *suf
int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
CGroupMask delegated_mask;
const char *p;
- Iterator i;
void *pidp;
int r, q;
@@ -1970,7 +1968,7 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
delegated_mask = unit_get_delegate_mask(u);
r = 0;
- SET_FOREACH(pidp, pids, i) {
+ SET_FOREACH(pidp, pids) {
pid_t pid = PTR_TO_PID(pidp);
CGroupController c;
@@ -2158,7 +2156,6 @@ static int unit_realize_cgroup_now_enable(Unit *u, ManagerState state) {
/* Controllers can only be disabled depth-first, from the leaves of the
* hierarchy upwards to the unit in question. */
static int unit_realize_cgroup_now_disable(Unit *u, ManagerState state) {
- Iterator i;
Unit *m;
void *v;
@@ -2167,7 +2164,7 @@ static int unit_realize_cgroup_now_disable(Unit *u, ManagerState state) {
if (u->type != UNIT_SLICE)
return 0;
- HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE]) {
CGroupMask target_mask, enable_mask, new_target_mask, new_enable_mask;
int r;
@@ -2331,14 +2328,13 @@ void unit_add_family_to_cgroup_realize_queue(Unit *u) {
* masks. */
do {
- Iterator i;
Unit *m;
void *v;
/* Children of u likely changed when we're called */
u->cgroup_members_mask_valid = false;
- HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE]) {
/* Skip units that have a dependency on the slice but aren't actually in it. */
if (UNIT_DEREF(m->slice) != u)
continue;
@@ -3527,10 +3523,9 @@ void unit_invalidate_cgroup_bpf(Unit *u) {
* list of our children includes our own. */
if (u->type == UNIT_SLICE) {
Unit *member;
- Iterator i;
void *v;
- HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE], i)
+ HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE])
if (UNIT_DEREF(member->slice) == u)
unit_invalidate_cgroup_bpf(member);
}
@@ -3552,12 +3547,11 @@ bool unit_cgroup_delegate(Unit *u) {
}
void manager_invalidate_startup_units(Manager *m) {
- Iterator i;
Unit *u;
assert(m);
- SET_FOREACH(u, m->startup_units, i)
+ SET_FOREACH(u, m->startup_units)
unit_invalidate_cgroup(u, CGROUP_MASK_CPU|CGROUP_MASK_IO|CGROUP_MASK_BLKIO);
}
diff --git a/src/core/core-varlink.c b/src/core/core-varlink.c
index 5a586f1e59..4bb262bd93 100644
--- a/src/core/core-varlink.c
+++ b/src/core/core-varlink.c
@@ -79,10 +79,9 @@ static int vl_method_get_user_record(Varlink *link, JsonVariant *parameters, Var
else if (p.user_name)
r = dynamic_user_lookup_name(m, p.user_name, &found_uid);
else {
- Iterator i;
DynamicUser *d;
- HASHMAP_FOREACH(d, m->dynamic_users, i) {
+ HASHMAP_FOREACH(d, m->dynamic_users) {
r = dynamic_user_current(d, &uid);
if (r == -EAGAIN) /* not realized yet? */
continue;
@@ -189,9 +188,8 @@ static int vl_method_get_group_record(Varlink *link, JsonVariant *parameters, Va
r = dynamic_user_lookup_name(m, p.group_name, (uid_t*) &found_gid);
else {
DynamicUser *d;
- Iterator i;
- HASHMAP_FOREACH(d, m->dynamic_users, i) {
+ HASHMAP_FOREACH(d, m->dynamic_users) {
uid_t uid;
r = dynamic_user_current(d, &uid);
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 9042f0baa8..8f915ac2f5 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -360,7 +360,6 @@ static int property_get_syscall_filter(
int r;
#if HAVE_SECCOMP
- Iterator i;
void *id, *val;
#endif
@@ -377,7 +376,7 @@ static int property_get_syscall_filter(
return r;
#if HAVE_SECCOMP
- HASHMAP_FOREACH_KEY(val, id, c->syscall_filter, i) {
+ HASHMAP_FOREACH_KEY(val, id, c->syscall_filter) {
_cleanup_free_ char *name = NULL;
const char *e = NULL;
char *s;
@@ -430,7 +429,6 @@ static int property_get_syscall_archs(
int r;
#if HAVE_SECCOMP
- Iterator i;
void *id;
#endif
@@ -439,7 +437,7 @@ static int property_get_syscall_archs(
assert(c);
#if HAVE_SECCOMP
- SET_FOREACH(id, c->syscall_archs, i) {
+ SET_FOREACH(id, c->syscall_archs) {
const char *name;
name = seccomp_arch_to_string(PTR_TO_UINT32(id) - 1);
@@ -526,7 +524,6 @@ static int property_get_address_families(
ExecContext *c = userdata;
_cleanup_strv_free_ char **l = NULL;
- Iterator i;
void *af;
int r;
@@ -542,7 +539,7 @@ static int property_get_address_families(
if (r < 0)
return r;
- SET_FOREACH(af, c->address_families, i) {
+ SET_FOREACH(af, c->address_families) {
const char *name;
name = af_to_name(PTR_TO_INT(af));
@@ -759,7 +756,6 @@ static int property_get_set_credential(
ExecContext *c = userdata;
ExecSetCredential *sc;
- Iterator iterator;
int r;
assert(bus);
@@ -771,7 +767,7 @@ static int property_get_set_credential(
if (r < 0)
return r;
- HASHMAP_FOREACH(sc, c->set_credentials, iterator) {
+ HASHMAP_FOREACH(sc, c->set_credentials) {
r = sd_bus_message_open_container(reply, 'r', "say");
if (r < 0)
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 0859bb3779..06443a4be4 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -164,14 +164,13 @@ static int bus_job_enumerate(sd_bus *bus, const char *path, void *userdata, char
_cleanup_strv_free_ char **l = NULL;
Manager *m = userdata;
unsigned k = 0;
- Iterator i;
Job *j;
l = new0(char*, hashmap_size(m->jobs)+1);
if (!l)
return -ENOMEM;
- HASHMAP_FOREACH(j, m->jobs, i) {
+ HASHMAP_FOREACH(j, m->jobs) {
l[k] = job_dbus_path(j);
if (!l[k])
return -ENOMEM;
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 16945d09c4..0ac87b56a8 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1058,7 +1058,6 @@ static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_e
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
Manager *m = userdata;
const char *k;
- Iterator i;
Unit *u;
int r;
@@ -1079,7 +1078,7 @@ static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_e
if (r < 0)
return r;
- HASHMAP_FOREACH_KEY(u, k, m->units, i) {
+ HASHMAP_FOREACH_KEY(u, k, m->units) {
if (k != u->id)
continue;
@@ -1139,7 +1138,6 @@ static int method_list_units_by_patterns(sd_bus_message *message, void *userdata
static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
Manager *m = userdata;
- Iterator i;
Job *j;
int r;
@@ -1160,7 +1158,7 @@ static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_erro
if (r < 0)
return r;
- HASHMAP_FOREACH(j, m->jobs, i) {
+ HASHMAP_FOREACH(j, m->jobs) {
_cleanup_free_ char *unit_path = NULL, *job_path = NULL;
job_path = job_dbus_path(j);
@@ -1759,7 +1757,6 @@ static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
Manager *m = userdata;
DynamicUser *d;
- Iterator i;
int r;
assert(message);
@@ -1778,7 +1775,7 @@ static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_
if (r < 0)
return r;
- HASHMAP_FOREACH(d, m->dynamic_users, i) {
+ HASHMAP_FOREACH(d, m->dynamic_users) {
uid_t uid;
r = dynamic_user_current(d, &uid);
@@ -1804,7 +1801,6 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata,
Manager *m = userdata;
UnitFileList *item;
Hashmap *h;
- Iterator i;
int r;
assert(message);
@@ -1832,7 +1828,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata,
if (r < 0)
goto fail;
- HASHMAP_FOREACH(item, h, i) {
+ HASHMAP_FOREACH(item, h) {
r = sd_bus_message_append(reply, "(ss)", item->path, unit_file_state_to_string(item->state));
if (r < 0)
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 09f88b385b..73052fac6d 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -42,7 +42,6 @@ static int property_get_exit_status_set(
const ExitStatusSet *status_set = userdata;
unsigned n;
- Iterator i;
int r;
assert(bus);
@@ -57,7 +56,7 @@ static int property_get_exit_status_set(
if (r < 0)
return r;
- BITMAP_FOREACH(n, &status_set->status, i) {
+ BITMAP_FOREACH(n, &status_set->status) {
assert(n < 256);
r = sd_bus_message_append_basic(reply, 'i', &n);
@@ -73,7 +72,7 @@ static int property_get_exit_status_set(
if (r < 0)
return r;
- BITMAP_FOREACH(n, &status_set->signal, i) {
+ BITMAP_FOREACH(n, &status_set->signal) {
const char *str;
str = signal_to_string(n);
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index e799771c22..d38c0f0582 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -103,7 +103,6 @@ static int property_get_names(
sd_bus_error *error) {
Unit *u = userdata;
- Iterator i;
const char *t;
int r;
@@ -119,7 +118,7 @@ static int property_get_names(
if (r < 0)
return r;
- SET_FOREACH(t, u->aliases, i) {
+ SET_FOREACH(t, u->aliases) {
r = sd_bus_message_append(reply, "s", t);
if (r < 0)
return r;
@@ -157,7 +156,6 @@ static int property_get_dependencies(
sd_bus_error *error) {
Hashmap **h = userdata;
- Iterator j;
Unit *u;
void *v;
int r;
@@ -170,7 +168,7 @@ static int property_get_dependencies(
if (r < 0)
return r;
- HASHMAP_FOREACH_KEY(v, u, *h, j) {
+ HASHMAP_FOREACH_KEY(v, u, *h) {
r = sd_bus_message_append(reply, "s", u->id);
if (r < 0)
return r;
@@ -190,7 +188,6 @@ static int property_get_requires_mounts_for(
Hashmap **h = userdata;
const char *p;
- Iterator j;
void *v;
int r;
@@ -202,7 +199,7 @@ static int property_get_requires_mounts_for(
if (r < 0)
return r;
- HASHMAP_FOREACH_KEY(v, p, *h, j) {
+ HASHMAP_FOREACH_KEY(v, p, *h) {
r = sd_bus_message_append(reply, "s", p);
if (r < 0)
return r;
@@ -1729,7 +1726,6 @@ int bus_unit_queue_job(
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_free_ char *job_path = NULL, *unit_path = NULL;
_cleanup_set_free_ Set *affected = NULL;
- Iterator i;
Job *j, *a;
int r;
@@ -1808,7 +1804,7 @@ int bus_unit_queue_job(
if (r < 0)
return r;
- SET_FOREACH(a, affected, i) {
+ SET_FOREACH(a, affected) {
if (a->id == j->id)
continue;
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 8958af48ce..774ee5632f 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -457,14 +457,13 @@ static int bus_unit_enumerate(sd_bus *bus, const char *path, void *userdata, cha
_cleanup_strv_free_ char **l = NULL;
Manager *m = userdata;
unsigned k = 0;
- Iterator i;
Unit *u;
l = new0(char*, hashmap_size(m->units)+1);
if (!l)
return -ENOMEM;
- HASHMAP_FOREACH(u, m->units, i) {
+ HASHMAP_FOREACH(u, m->units) {
l[k] = unit_dbus_path(u);
if (!l[k])
return -ENOMEM;
@@ -767,7 +766,6 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void
}
static int bus_setup_api(Manager *m, sd_bus *bus) {
- Iterator i;
char *name;
Unit *u;
int r;
@@ -787,7 +785,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) {
if (r < 0)
return r;
- HASHMAP_FOREACH_KEY(u, name, m->watch_bus, i) {
+ HASHMAP_FOREACH_KEY(u, name, m->watch_bus) {
r = unit_install_bus_match(u, bus, name);
if (r < 0)
log_error_errno(r, "Failed to subscribe to NameOwnerChanged signal for '%s': %m", name);
@@ -976,7 +974,6 @@ int bus_init_private(Manager *m) {
}
static void destroy_bus(Manager *m, sd_bus **bus) {
- Iterator i;
Unit *u;
Job *j;
@@ -987,7 +984,7 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
return;
/* Make sure all bus slots watching names are released. */
- HASHMAP_FOREACH(u, m->watch_bus, i) {
+ HASHMAP_FOREACH(u, m->watch_bus) {
if (u->match_bus_slot && sd_bus_slot_get_bus(u->match_bus_slot) == *bus)
u->match_bus_slot = sd_bus_slot_unref(u->match_bus_slot);
if (u->get_name_owner_slot && sd_bus_slot_get_bus(u->get_name_owner_slot) == *bus)
@@ -998,11 +995,11 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus)
m->subscribed = sd_bus_track_unref(m->subscribed);
- HASHMAP_FOREACH(j, m->jobs, i)
+ HASHMAP_FOREACH(j, m->jobs)
if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus)
j->bus_track = sd_bus_track_unref(j->bus_track);
- HASHMAP_FOREACH(u, m->units, i) {
+ HASHMAP_FOREACH(u, m->units) {
if (u->bus_track && sd_bus_track_get_bus(u->bus_track) == *bus)
u->bus_track = sd_bus_track_unref(u->bus_track);
@@ -1060,7 +1057,6 @@ void bus_done(Manager *m) {
}
int bus_fdset_add_all(Manager *m, FDSet *fds) {
- Iterator i;
sd_bus *b;
int fd;
@@ -1083,7 +1079,7 @@ int bus_fdset_add_all(Manager *m, FDSet *fds) {
}
}
- SET_FOREACH(b, m->private_buses, i) {
+ SET_FOREACH(b, m->private_buses) {
fd = sd_bus_get_fd(b);
if (fd >= 0) {
fd = fdset_put_dup(fds, fd);
@@ -1105,12 +1101,11 @@ int bus_foreach_bus(
int (*send_message)(sd_bus *bus, void *userdata),
void *userdata) {
- Iterator i;
sd_bus *b;
int r, ret = 0;
/* Send to all direct buses, unconditionally */
- SET_FOREACH(b, m->private_buses, i) {
+ SET_FOREACH(b, m->private_buses) {
/* Don't bother with enqueuing these messages to clients that haven't started yet */
if (sd_bus_is_ready(b) <= 0)
@@ -1191,13 +1186,12 @@ int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_er
uint64_t manager_bus_n_queued_write(Manager *m) {
uint64_t c = 0;
- Iterator i;
sd_bus *b;
int r;
/* Returns the total number of messages queued for writing on all our direct and API buses. */
- SET_FOREACH(b, m->private_buses, i) {
+ SET_FOREACH(b, m->private_buses) {
uint64_t k;
r = sd_bus_get_n_queued_write(b, &k);
diff --git a/src/core/device.c b/src/core/device.c
index 53bc549bd3..31aa3341c2 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -468,13 +468,12 @@ static bool device_is_bound_by_mounts(Device *d, sd_device *dev) {
static void device_upgrade_mount_deps(Unit *u) {
Unit *other;
- Iterator i;
void *v;
int r;
/* Let's upgrade Requires= to BindsTo= on us. (Used when SYSTEMD_MOUNT_DEVICE_BOUND is set) */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REQUIRED_BY], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REQUIRED_BY]) {
if (other->type != UNIT_MOUNT)
continue;
diff --git a/src/core/dynamic-user.c b/src/core/dynamic-user.c
index 58b37925bf..be386df12b 100644
--- a/src/core/dynamic-user.c
+++ b/src/core/dynamic-user.c
@@ -611,7 +611,6 @@ static DynamicUser* dynamic_user_destroy(DynamicUser *d) {
int dynamic_user_serialize(Manager *m, FILE *f, FDSet *fds) {
DynamicUser *d;
- Iterator i;
assert(m);
assert(f);
@@ -619,7 +618,7 @@ int dynamic_user_serialize(Manager *m, FILE *f, FDSet *fds) {
/* Dump the dynamic user database into the manager serialization, to deal with daemon reloads. */
- HASHMAP_FOREACH(d, m->dynamic_users, i) {
+ HASHMAP_FOREACH(d, m->dynamic_users) {
int copy0, copy1;
copy0 = fdset_put_dup(fds, d->storage_socket[0]);
@@ -674,7 +673,6 @@ void dynamic_user_deserialize_one(Manager *m, const char *value, FDSet *fds) {
void dynamic_user_vacuum(Manager *m, bool close_user) {
DynamicUser *d;
- Iterator i;
assert(m);
@@ -682,7 +680,7 @@ void dynamic_user_vacuum(Manager *m, bool close_user) {
* to which no reference exist. This is called after a daemon reload finished, in order to destroy users which
* might not be referenced anymore. */
- HASHMAP_FOREACH(d, m->dynamic_users, i) {
+ HASHMAP_FOREACH(d, m->dynamic_users) {
if (d->n_ref > 0)
continue;
diff --git a/src/core/execute.c b/src/core/execute.c
index e02a55e222..e2fc61fe78 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2483,7 +2483,6 @@ static int acquire_credentials(
_cleanup_close_ int dfd = -1;
ExecSetCredential *sc;
char **id, **fn;
- Iterator iterator;
int r;
assert(context);
@@ -2495,7 +2494,7 @@ static int acquire_credentials(
/* First we use the literally specified credentials. Note that they might be overriden again below,
* and thus act as a "default" if the same credential is specified multiple times */
- HASHMAP_FOREACH(sc, context->set_credentials, iterator) {
+ HASHMAP_FOREACH(sc, context->set_credentials) {
size_t add;
add = strlen(sc->id) + sc->size;
@@ -5484,7 +5483,6 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
if (c->syscall_filter) {
#if HAVE_SECCOMP
- Iterator j;
void *id, *val;
bool first = true;
#endif
@@ -5497,7 +5495,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
fputc('~', f);
#if HAVE_SECCOMP
- HASHMAP_FOREACH_KEY(val, id, c->syscall_filter, j) {
+ HASHMAP_FOREACH_KEY(val, id, c->syscall_filter) {
_cleanup_free_ char *name = NULL;
const char *errno_name = NULL;
int num = PTR_TO_INT(val);
@@ -5525,7 +5523,6 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
if (c->syscall_archs) {
#if HAVE_SECCOMP
- Iterator j;
void *id;
#endif
@@ -5534,7 +5531,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
prefix);
#if HAVE_SECCOMP
- SET_FOREACH(id, c->syscall_archs, j)
+ SET_FOREACH(id, c->syscall_archs)
fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1)));
#endif
fputc('\n', f);
@@ -6100,13 +6097,12 @@ ExecRuntime *exec_runtime_unref(ExecRuntime *rt, bool destroy) {
int exec_runtime_serialize(const Manager *m, FILE *f, FDSet *fds) {
ExecRuntime *rt;
- Iterator i;
assert(m);
assert(f);
assert(fds);
- HASHMAP_FOREACH(rt, m->exec_runtime_by_id, i) {
+ HASHMAP_FOREACH(rt, m->exec_runtime_by_id) {
fprintf(f, "exec-runtime=%s", rt->id);
if (rt->tmp_dir)
@@ -6309,13 +6305,12 @@ finalize:
void exec_runtime_vacuum(Manager *m) {
ExecRuntime *rt;
- Iterator i;
assert(m);
/* Free unreferenced ExecRuntime objects. This is used after manager deserialization process. */
- HASHMAP_FOREACH(rt, m->exec_runtime_by_id, i) {
+ HASHMAP_FOREACH(rt, m->exec_runtime_by_id) {
if (rt->n_ref > 0)
continue;
diff --git a/src/core/job.c b/src/core/job.c
index d97cb64d38..063f3f7892 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -458,7 +458,6 @@ int job_type_merge_and_collapse(JobType *a, JobType b, Unit *u) {
}
static bool job_is_runnable(Job *j) {
- Iterator i;
Unit *other;
void *v;
@@ -482,7 +481,7 @@ static bool job_is_runnable(Job *j) {
if (j->type == JOB_NOP)
return true;
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER], i)
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER])
if (other->job && job_compare(j, other->job, UNIT_AFTER) > 0) {
log_unit_debug(j->unit,
"starting held back, waiting for: %s",
@@ -490,7 +489,7 @@ static bool job_is_runnable(Job *j) {
return false;
}
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE], i)
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE])
if (other->job && job_compare(j, other->job, UNIT_BEFORE) > 0) {
log_unit_debug(j->unit,
"stopping held back, waiting for: %s",
@@ -957,12 +956,11 @@ static void job_emit_done_status_message(Unit *u, uint32_t job_id, JobType t, Jo
static void job_fail_dependencies(Unit *u, UnitDependency d) {
Unit *other;
- Iterator i;
void *v;
assert(u);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[d], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[d]) {
Job *j = other->job;
if (!j)
@@ -978,7 +976,6 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
Unit *u;
Unit *other;
JobType t;
- Iterator i;
void *v;
assert(j);
@@ -1072,12 +1069,12 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
finish:
/* Try to start the next jobs that can be started */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_AFTER], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_AFTER])
if (other->job) {
job_add_to_run_queue(other->job);
job_add_to_gc_queue(other->job);
}
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BEFORE], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BEFORE])
if (other->job) {
job_add_to_run_queue(other->job);
job_add_to_gc_queue(other->job);
@@ -1427,7 +1424,6 @@ int job_get_timeout(Job *j, usec_t *timeout) {
bool job_may_gc(Job *j) {
Unit *other;
- Iterator i;
void *v;
assert(j);
@@ -1457,11 +1453,11 @@ bool job_may_gc(Job *j) {
return false;
/* The logic is inverse to job_is_runnable, we cannot GC as long as we block any job. */
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE], i)
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE])
if (other->job && job_compare(j, other->job, UNIT_BEFORE) < 0)
return false;
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER], i)
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER])
if (other->job && job_compare(j, other->job, UNIT_AFTER) < 0)
return false;
@@ -1508,7 +1504,6 @@ int job_get_before(Job *j, Job*** ret) {
_cleanup_free_ Job** list = NULL;
size_t n = 0, n_allocated = 0;
Unit *other = NULL;
- Iterator i;
void *v;
/* Returns a list of all pending jobs that need to finish before this job may be started. */
@@ -1521,7 +1516,7 @@ int job_get_before(Job *j, Job*** ret) {
return 0;
}
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER], i) {
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER]) {
if (!other->job)
continue;
if (job_compare(j, other->job, UNIT_AFTER) <= 0)
@@ -1532,7 +1527,7 @@ int job_get_before(Job *j, Job*** ret) {
list[n++] = other->job;
}
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE]) {
if (!other->job)
continue;
if (job_compare(j, other->job, UNIT_BEFORE) <= 0)
@@ -1555,14 +1550,13 @@ int job_get_after(Job *j, Job*** ret) {
size_t n = 0, n_allocated = 0;
Unit *other = NULL;
void *v;
- Iterator i;
assert(j);
assert(ret);
/* Returns a list of all pending jobs that are waiting for this job to finish. */
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE]) {
if (!other->job)
continue;
@@ -1577,7 +1571,7 @@ int job_get_after(Job *j, Job*** ret) {
list[n++] = other->job;
}
- HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER], i) {
+ HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER]) {
if (!other->job)
continue;
diff --git a/src/core/killall.c b/src/core/killall.c
index 075c705ca7..0272fdb0da 100644
--- a/src/core/killall.c
+++ b/src/core/killall.c
@@ -79,10 +79,9 @@ static bool ignore_proc(pid_t pid, bool warn_rootfs) {
static void log_children_no_yet_killed(Set *pids) {
_cleanup_free_ char *lst_child = NULL;
- Iterator i;
void *p;
- SET_FOREACH(p, pids, i) {
+ SET_FOREACH(p, pids) {
_cleanup_free_ char *s = NULL;
if (get_process_comm(PTR_TO_PID(p), &s) < 0)
@@ -121,7 +120,6 @@ static int wait_for_children(Set *pids, sigset_t *mask, usec_t timeout) {
struct timespec ts;
int k;
void *p;
- Iterator i;
/* First, let the kernel inform us about killed
* children. Most processes will probably be our
@@ -145,7 +143,7 @@ static int wait_for_children(Set *pids, sigset_t *mask, usec_t timeout) {
/* Now explicitly check who might be remaining, who
* might not be our child. */
- SET_FOREACH(p, pids, i) {
+ SET_FOREACH(p, pids) {
/* kill(pid, 0) sends no signal, but it tells
* us whether the process still exists. */
diff --git a/src/core/manager.c b/src/core/manager.c
index 5372e81d97..b6165bd7e8 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -198,7 +198,6 @@ static void manager_flip_auto_status(Manager *m, bool enable, const char *reason
static void manager_print_jobs_in_progress(Manager *m) {
_cleanup_free_ char *job_of_n = NULL;
- Iterator i;
Job *j;
unsigned counter = 0, print_nr;
char cylon[6 + CYLON_BUFFER_EXTRA + 1];
@@ -213,7 +212,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
print_nr = (m->jobs_in_progress_iteration / JOBS_IN_PROGRESS_PERIOD_DIVISOR) % m->n_running_jobs;
- HASHMAP_FOREACH(j, m->jobs, i)
+ HASHMAP_FOREACH(j, m->jobs)
if (j->state == JOB_RUNNING && counter++ == print_nr)
break;
@@ -1147,13 +1146,12 @@ enum {
static void unit_gc_mark_good(Unit *u, unsigned gc_marker) {
Unit *other;
- Iterator i;
void *v;
u->gc_marker = gc_marker + GC_OFFSET_GOOD;
/* Recursively mark referenced units as GOOD as well */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REFERENCES], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REFERENCES])
if (other->gc_marker == gc_marker + GC_OFFSET_UNSURE)
unit_gc_mark_good(other, gc_marker);
}
@@ -1161,7 +1159,6 @@ static void unit_gc_mark_good(Unit *u, unsigned gc_marker) {
static void unit_gc_sweep(Unit *u, unsigned gc_marker) {
Unit *other;
bool is_bad;
- Iterator i;
void *v;
assert(u);
@@ -1180,7 +1177,7 @@ static void unit_gc_sweep(Unit *u, unsigned gc_marker) {
is_bad = true;
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REFERENCED_BY], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REFERENCED_BY]) {
unit_gc_sweep(other, gc_marker);
if (other->gc_marker == gc_marker + GC_OFFSET_GOOD)
@@ -1474,7 +1471,6 @@ static void manager_enumerate(Manager *m) {
}
static void manager_coldplug(Manager *m) {
- Iterator i;
Unit *u;
char *k;
int r;
@@ -1484,7 +1480,7 @@ static void manager_coldplug(Manager *m) {
log_debug("Invoking unit coldplug() handlers…");
/* Let's place the units back into their deserialized state */
- HASHMAP_FOREACH_KEY(u, k, m->units, i) {
+ HASHMAP_FOREACH_KEY(u, k, m->units) {
/* ignore aliases */
if (u->id != k)
@@ -1497,7 +1493,6 @@ static void manager_coldplug(Manager *m) {
}
static void manager_catchup(Manager *m) {
- Iterator i;
Unit *u;
char *k;
@@ -1506,7 +1501,7 @@ static void manager_catchup(Manager *m) {
log_debug("Invoking unit catchup() handlers…");
/* Let's catch up on any state changes that happened while we were reloading/reexecing */
- HASHMAP_FOREACH_KEY(u, k, m->units, i) {
+ HASHMAP_FOREACH_KEY(u, k, m->units) {
/* ignore aliases */
if (u->id != k)
@@ -1517,12 +1512,11 @@ static void manager_catchup(Manager *m) {
}
static void manager_distribute_fds(Manager *m, FDSet *fds) {
- Iterator i;
Unit *u;
assert(m);
- HASHMAP_FOREACH(u, m->units, i) {
+ HASHMAP_FOREACH(u, m->units) {
if (fdset_size(fds) <= 0)
break;
@@ -1903,10 +1897,9 @@ static int manager_dispatch_target_deps_queue(Manager *m) {
for (k = 0; k < ELEMENTSOF(deps); k++) {
Unit *target;
- Iterator i;
void *v;
- HASHMAP_FOREACH_KEY(v, target, u->dependencies[deps[k]], i) {
+ HASHMAP_FOREACH_KEY(v, target, u->dependencies[deps[k]]) {
r = unit_add_default_target_dependency(u, target);
if (r < 0)
return r;
@@ -2099,25 +2092,23 @@ int manager_load_startable_unit_or_warn(
}
void manager_dump_jobs(Manager *s, FILE *f, const char *prefix) {
- Iterator i;
Job *j;
assert(s);
assert(f);
- HASHMAP_FOREACH(j, s->jobs, i)
+ HASHMAP_FOREACH(j, s->jobs)
job_dump(j, f, prefix);
}
void manager_dump_units(Manager *s, FILE *f, const char *prefix) {
- Iterator i;
Unit *u;
const char *t;
assert(s);
assert(f);
- HASHMAP_FOREACH_KEY(u, t, s->units, i)
+ HASHMAP_FOREACH_KEY(u, t, s->units)
if (u->id == t)
unit_dump(u, f, prefix);
}
@@ -2840,7 +2831,6 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
static int manager_dispatch_time_change_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
Manager *m = userdata;
- Iterator i;
Unit *u;
assert(m);
@@ -2853,7 +2843,7 @@ static int manager_dispatch_time_change_fd(sd_event_source *source, int fd, uint
/* Restart the watch */
(void) manager_setup_time_change(m);
- HASHMAP_FOREACH(u, m->units, i)
+ HASHMAP_FOREACH(u, m->units)
if (UNIT_VTABLE(u)->time_change)
UNIT_VTABLE(u)->time_change(u);
@@ -2867,7 +2857,6 @@ static int manager_dispatch_timezone_change(
Manager *m = userdata;
int changed;
- Iterator i;
Unit *u;
assert(m);
@@ -2886,7 +2875,7 @@ static int manager_dispatch_timezone_change(
log_debug("Timezone has been changed (now: %s).", tzname[daylight]);
- HASHMAP_FOREACH(u, m->units, i)
+ HASHMAP_FOREACH(u, m->units)
if (UNIT_VTABLE(u)->timezone_change)
UNIT_VTABLE(u)->timezone_change(u);
@@ -3189,7 +3178,6 @@ static void manager_serialize_uid_refs_internal(
Hashmap **uid_refs,
const char *field_name) {
- Iterator i;
void *p, *k;
assert(m);
@@ -3200,7 +3188,7 @@ static void manager_serialize_uid_refs_internal(
/* Serialize the UID reference table. Or actually, just the IPC destruction flag of it, as
* the actual counter of it is better rebuild after a reload/reexec. */
- HASHMAP_FOREACH_KEY(p, k, *uid_refs, i) {
+ HASHMAP_FOREACH_KEY(p, k, *uid_refs) {
uint32_t c;
uid_t uid;
@@ -3230,7 +3218,6 @@ int manager_serialize(
ManagerTimestamp q;
const char *t;
- Iterator i;
Unit *u;
int r;
@@ -3323,7 +3310,7 @@ int manager_serialize(
(void) fputc('\n', f);
- HASHMAP_FOREACH_KEY(u, t, m->units, i) {
+ HASHMAP_FOREACH_KEY(u, t, m->units) {
if (u->id != t)
continue;
@@ -3826,11 +3813,10 @@ int manager_reload(Manager *m) {
void manager_reset_failed(Manager *m) {
Unit *u;
- Iterator i;
assert(m);
- HASHMAP_FOREACH(u, m->units, i)
+ HASHMAP_FOREACH(u, m->units)
unit_reset_failed(u);
}
@@ -4663,14 +4649,13 @@ static void manager_vacuum_uid_refs_internal(
Hashmap **uid_refs,
int (*_clean_ipc)(uid_t uid)) {
- Iterator i;
void *p, *k;
assert(m);
assert(uid_refs);
assert(_clean_ipc);
- HASHMAP_FOREACH_KEY(p, k, *uid_refs, i) {
+ HASHMAP_FOREACH_KEY(p, k, *uid_refs) {
uint32_t c, n;
uid_t uid;
diff --git a/src/core/mount.c b/src/core/mount.c
index 6e9d61ff18..dbbb73f3d5 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -281,7 +281,6 @@ static int update_parameters_proc_self_mountinfo(
static int mount_add_mount_dependencies(Mount *m) {
MountParameters *pm;
Unit *other;
- Iterator i;
Set *s;
int r;
@@ -315,7 +314,7 @@ static int mount_add_mount_dependencies(Mount *m) {
/* Adds in dependencies to other units that use this path or paths further down in the hierarchy */
s = manager_get_units_requiring_mounts_for(UNIT(m)->manager, m->where);
- SET_FOREACH(other, s, i) {
+ SET_FOREACH(other, s) {
if (other->load_state != UNIT_LOADED)
continue;
@@ -1903,7 +1902,6 @@ static int drain_libmount(Manager *m) {
static int mount_process_proc_self_mountinfo(Manager *m) {
_cleanup_set_free_free_ Set *around = NULL, *gone = NULL;
const char *what;
- Iterator i;
Unit *u;
int r;
@@ -2001,7 +1999,7 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
mount->proc_flags = 0;
}
- SET_FOREACH(what, gone, i) {
+ SET_FOREACH(what, gone) {
if (set_contains(around, what))
continue;
diff --git a/src/core/service.c b/src/core/service.c
index dec6b2c9ea..14c90c26df 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1273,13 +1273,12 @@ static int service_collect_fds(
rn_socket_fds = 1;
} else {
- Iterator i;
void *v;
Unit *u;
/* Pass all our configured sockets for singleton services */
- HASHMAP_FOREACH_KEY(v, u, UNIT(s)->dependencies[UNIT_TRIGGERED_BY], i) {
+ HASHMAP_FOREACH_KEY(v, u, UNIT(s)->dependencies[UNIT_TRIGGERED_BY]) {
_cleanup_free_ int *cfds = NULL;
Socket *sock;
int cn_fds;
diff --git a/src/core/slice.c b/src/core/slice.c
index f4f63fcb5b..aa7e7555e5 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -351,11 +351,10 @@ static void slice_enumerate_perpetual(Manager *m) {
static bool slice_freezer_action_supported_by_children(Unit *s) {
Unit *member;
void *v;
- Iterator i;
assert(s);
- HASHMAP_FOREACH_KEY(v, member, s->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, member, s->dependencies[UNIT_BEFORE]) {
int r;
if (UNIT_DEREF(member->slice) != s)
@@ -377,7 +376,6 @@ static bool slice_freezer_action_supported_by_children(Unit *s) {
static int slice_freezer_action(Unit *s, FreezerAction action) {
Unit *member;
void *v;
- Iterator i;
int r;
assert(s);
@@ -386,7 +384,7 @@ static int slice_freezer_action(Unit *s, FreezerAction action) {
if (!slice_freezer_action_supported_by_children(s))
return log_unit_warning(s, "Requested freezer operation is not supported by all children of the slice");
- HASHMAP_FOREACH_KEY(v, member, s->dependencies[UNIT_BEFORE], i) {
+ HASHMAP_FOREACH_KEY(v, member, s->dependencies[UNIT_BEFORE]) {
if (UNIT_DEREF(member->slice) != s)
continue;
diff --git a/src/core/socket.c b/src/core/socket.c
index 20c09b2a3f..855b354dd8 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -2338,12 +2338,11 @@ static void socket_enter_running(Socket *s, int cfd_in) {
if (cfd < 0) {
bool pending = false;
Unit *other;
- Iterator i;
void *v;
/* If there's already a start pending don't bother to
* do anything */
- HASHMAP_FOREACH_KEY(v, other, UNIT(s)->dependencies[UNIT_TRIGGERS], i)
+ HASHMAP_FOREACH_KEY(v, other, UNIT(s)->dependencies[UNIT_TRIGGERS])
if (unit_active_or_pending(other)) {
pending = true;
break;
@@ -2788,7 +2787,6 @@ static void socket_distribute_fds(Unit *u, FDSet *fds) {
assert(u);
LIST_FOREACH(port, p, s->ports) {
- Iterator i;
int fd;
if (p->type != SOCKET_SOCKET)
@@ -2797,7 +2795,7 @@ static void socket_distribute_fds(Unit *u, FDSet *fds) {
if (p->fd >= 0)
continue;
- FDSET_FOREACH(fd, fds, i) {
+ FDSET_FOREACH(fd, fds) {
if (socket_address_matches_fd(&p->address, fd)) {
p->fd = fdset_remove(fds, fd);
s->deserialized_state = SOCKET_LISTENING;
diff --git a/src/core/target.c b/src/core/target.c
index 65affcec19..3f85773b24 100644
--- a/src/core/target.c
+++ b/src/core/target.c
@@ -57,10 +57,9 @@ static int target_add_default_dependencies(Target *t) {
for (k = 0; k < ELEMENTSOF(deps); k++) {
Unit *other;
- Iterator i;
void *v;
- HASHMAP_FOREACH_KEY(v, other, UNIT(t)->dependencies[deps[k]], i) {
+ HASHMAP_FOREACH_KEY(v, other, UNIT(t)->dependencies[deps[k]]) {
r = unit_add_default_target_dependency(other, UNIT(t));
if (r < 0)
return r;
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 0fa419787e..ab07c80f1d 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -218,14 +218,13 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
Job *j;
- Iterator i;
int r;
assert(tr);
/* First step, check whether any of the jobs for one specific
* task conflict. If so, try to drop one of them. */
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
JobType t;
Job *k;
@@ -256,7 +255,7 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
}
/* Second step, merge the jobs. */
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
JobType t = j->type;
Job *k;
@@ -288,12 +287,11 @@ static void transaction_drop_redundant(Transaction *tr) {
assert(tr);
do {
- Iterator i;
Job *j;
again = false;
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
bool keep = false;
Job *k;
@@ -349,7 +347,6 @@ static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
}
static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsigned generation, sd_bus_error *e) {
- Iterator i;
Unit *u;
void *v;
int r;
@@ -453,7 +450,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
* ordering dependencies and we test with job_compare() whether it is the 'before' edge in the job
* execution ordering. */
for (d = 0; d < ELEMENTSOF(directions); d++) {
- HASHMAP_FOREACH_KEY(v, u, j->unit->dependencies[directions[d]], i) {
+ HASHMAP_FOREACH_KEY(v, u, j->unit->dependencies[directions[d]]) {
Job *o;
/* Is there a job for this unit? */
@@ -487,7 +484,6 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
static int transaction_verify_order(Transaction *tr, unsigned *generation, sd_bus_error *e) {
Job *j;
int r;
- Iterator i;
unsigned g;
assert(tr);
@@ -498,7 +494,7 @@ static int transaction_verify_order(Transaction *tr, unsigned *generation, sd_bu
g = (*generation)++;
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
r = transaction_verify_order_one(tr, j, NULL, g, e);
if (r < 0)
return r;
@@ -515,12 +511,11 @@ static void transaction_collect_garbage(Transaction *tr) {
/* Drop jobs that are not required by any other job */
do {
- Iterator i;
Job *j;
again = false;
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
if (tr->anchor_job == j)
continue;
@@ -541,7 +536,6 @@ static void transaction_collect_garbage(Transaction *tr) {
}
static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_error *e) {
- Iterator i;
Job *j;
assert(tr);
@@ -549,7 +543,7 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro
/* Checks whether applying this transaction means that
* existing jobs would be replaced */
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
/* Assume merged */
assert(!j->transaction_prev);
@@ -568,7 +562,6 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro
static void transaction_minimize_impact(Transaction *tr) {
Job *j;
- Iterator i;
assert(tr);
@@ -576,7 +569,7 @@ static void transaction_minimize_impact(Transaction *tr) {
* or that stop a running service. */
rescan:
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
LIST_FOREACH(transaction, j, j) {
bool stops_running_service, changes_existing_job;
@@ -625,7 +618,6 @@ static int transaction_apply(
JobMode mode,
Set *affected_jobs) {
- Iterator i;
Job *j;
int r;
@@ -635,7 +627,7 @@ static int transaction_apply(
/* When isolating first kill all installed jobs which
* aren't part of the new transaction */
- HASHMAP_FOREACH(j, m->jobs, i) {
+ HASHMAP_FOREACH(j, m->jobs) {
assert(j->installed);
if (j->unit->ignore_on_isolate)
@@ -651,7 +643,7 @@ static int transaction_apply(
}
}
- HASHMAP_FOREACH(j, tr->jobs, i) {
+ HASHMAP_FOREACH(j, tr->jobs) {
/* Assume merged */
assert(!j->transaction_prev);
assert(!j->transaction_next);
@@ -696,7 +688,7 @@ static int transaction_apply(
rollback:
- HASHMAP_FOREACH(j, tr->jobs, i)
+ HASHMAP_FOREACH(j, tr->jobs)
hashmap_remove(m->jobs, UINT32_TO_PTR(j->id));
return r;
@@ -709,7 +701,6 @@ int transaction_activate(
Set *affected_jobs,
sd_bus_error *e) {
- Iterator i;
Job *j;
int r;
unsigned generation = 1;
@@ -722,7 +713,7 @@ int transaction_activate(
/* Reset the generation counter of all installed jobs. The detection of cycles
* looks at installed jobs. If they had a non-zero generation from some previous
* walk of the graph, the algorithm would break. */
- HASHMAP_FOREACH(j, m->jobs, i)
+ HASHMAP_FOREACH(j, m->jobs)
j->generation = 0;
/* First step: figure out which jobs matter */
@@ -890,7 +881,6 @@ static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependen
}
void transaction_add_propagate_reload_jobs(Transaction *tr, Unit *unit, Job *by, bool ignore_order, sd_bus_error *e) {
- Iterator i;
JobType nt;
Unit *dep;
void *v;
@@ -899,7 +889,7 @@ void transaction_add_propagate_reload_jobs(Transaction *tr, Unit *unit, Job *by,
assert(tr);
assert(unit);
- HASHMAP_FOREACH_KEY(v, dep, unit->dependencies[UNIT_PROPAGATES_RELOAD_TO], i) {
+ HASHMAP_FOREACH_KEY(v, dep, unit->dependencies[UNIT_PROPAGATES_RELOAD_TO]) {
nt = job_type_collapse(JOB_TRY_RELOAD, dep);
if (nt == JOB_NOP)
continue;
@@ -926,7 +916,6 @@ int transaction_add_job_and_dependencies(
sd_bus_error *e) {
bool is_new;
- Iterator i;
Unit *dep;
Job *ret;
void *v;
@@ -1006,7 +995,7 @@ int transaction_add_job_and_dependencies(
/* If we are following some other unit, make sure we
* add all dependencies of everybody following. */
if (unit_following_set(ret->unit, &following) > 0) {
- SET_FOREACH(dep, following, i) {
+ SET_FOREACH(dep, following) {
r = transaction_add_job_and_dependencies(tr, type, dep, ret, false, false, false, ignore_order, e);
if (r < 0) {
log_unit_full(dep,
@@ -1022,7 +1011,7 @@ int transaction_add_job_and_dependencies(
/* Finally, recursively add in all dependencies. */
if (IN_SET(type, JOB_START, JOB_RESTART)) {
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_REQUIRES], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_REQUIRES]) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, false, false, ignore_order, e);
if (r < 0) {
if (r != -EBADR) /* job type not applicable */
@@ -1032,7 +1021,7 @@ int transaction_add_job_and_dependencies(
}
}
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_BINDS_TO], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_BINDS_TO]) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, false, false, ignore_order, e);
if (r < 0) {
if (r != -EBADR) /* job type not applicable */
@@ -1042,7 +1031,7 @@ int transaction_add_job_and_dependencies(
}
}
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_WANTS], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_WANTS]) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, ignore_order, e);
if (r < 0) {
/* unit masked, job type not applicable and unit not found are not considered as errors. */
@@ -1054,7 +1043,7 @@ int transaction_add_job_and_dependencies(
}
}
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_REQUISITE], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_REQUISITE]) {
r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, true, false, false, ignore_order, e);
if (r < 0) {
if (r != -EBADR) /* job type not applicable */
@@ -1064,7 +1053,7 @@ int transaction_add_job_and_dependencies(
}
}
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_CONFLICTS], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_CONFLICTS]) {
r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, true, true, false, ignore_order, e);
if (r < 0) {
if (r != -EBADR) /* job type not applicable */
@@ -1074,7 +1063,7 @@ int transaction_add_job_and_dependencies(
}
}
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_CONFLICTED_BY], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[UNIT_CONFLICTED_BY]) {
r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, false, false, false, ignore_order, e);
if (r < 0) {
log_unit_warning(dep,
@@ -1103,7 +1092,7 @@ int transaction_add_job_and_dependencies(
ptype = type == JOB_RESTART ? JOB_TRY_RESTART : type;
for (j = 0; j < ELEMENTSOF(propagate_deps); j++)
- HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[propagate_deps[j]], i) {
+ HASHMAP_FOREACH_KEY(v, dep, ret->unit->dependencies[propagate_deps[j]]) {
JobType nt;
nt = job_type_collapse(ptype, dep);
@@ -1133,7 +1122,6 @@ fail:
}
int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
- Iterator i;
Unit *u;
char *k;
int r;
@@ -1141,7 +1129,7 @@ int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
assert(tr);
assert(m);
- HASHMAP_FOREACH_KEY(u, k, m->units, i) {
+ HASHMAP_FOREACH_KEY(u, k, m->units) {
/* ignore aliases */
if (u->id != k)
@@ -1167,7 +1155,6 @@ int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
}
int transaction_add_triggering_jobs(Transaction *tr, Unit *u) {
- Iterator i;
void *v;
Unit *trigger;
int r;
@@ -1175,7 +1162,7 @@ int transaction_add_triggering_jobs(Transaction *tr, Unit *u) {
assert(tr);
assert(u);
- HASHMAP_FOREACH_KEY(v, trigger, u->dependencies[UNIT_TRIGGERED_BY], i) {
+ HASHMAP_FOREACH_KEY(v, trigger, u->dependencies[UNIT_TRIGGERED_BY]) {
/* No need to stop inactive jobs */
if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(trigger)) && !trigger->job)
continue;
diff --git a/src/core/unit.c b/src/core/unit.c
index eb8d5d6a82..96a21b95b3 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -510,14 +510,13 @@ void unit_submit_to_stop_when_unneeded_queue(Unit *u) {
static void bidi_set_free(Unit *u, Hashmap *h) {
Unit *other;
- Iterator i;
void *v;
assert(u);
/* Frees the hashmap and makes sure we are dropped from the inverse pointers */
- HASHMAP_FOREACH_KEY(v, other, h, i) {
+ HASHMAP_FOREACH_KEY(v, other, h) {
for (UnitDependency d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
hashmap_remove(other->dependencies[d], u);
@@ -614,7 +613,6 @@ static void unit_done(Unit *u) {
}
void unit_free(Unit *u) {
- Iterator i;
char *t;
if (!u)
@@ -638,7 +636,7 @@ void unit_free(Unit *u) {
unit_free_requires_mounts_for(u);
- SET_FOREACH(t, u->aliases, i)
+ SET_FOREACH(t, u->aliases)
hashmap_remove_value(u->manager->units, t, u);
if (u->id)
hashmap_remove_value(u->manager->units, u->id, u);
@@ -819,7 +817,6 @@ static int hashmap_complete_move(Hashmap **s, Hashmap **other) {
static int merge_names(Unit *u, Unit *other) {
char *name;
- Iterator i;
int r;
assert(u);
@@ -838,7 +835,7 @@ static int merge_names(Unit *u, Unit *other) {
TAKE_PTR(other->id);
other->aliases = set_free_free(other->aliases);
- SET_FOREACH(name, u->aliases, i)
+ SET_FOREACH(name, u->aliases)
assert_se(hashmap_replace(u->manager->units, name, u) == 0);
return 0;
@@ -866,7 +863,6 @@ static int reserve_dependencies(Unit *u, Unit *other, UnitDependency d) {
}
static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitDependency d) {
- Iterator i;
Unit *back;
void *v;
int r;
@@ -878,7 +874,7 @@ static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitD
assert(d < _UNIT_DEPENDENCY_MAX);
/* Fix backwards pointers. Let's iterate through all dependent units of the other unit. */
- HASHMAP_FOREACH_KEY(v, back, other->dependencies[d], i)
+ HASHMAP_FOREACH_KEY(v, back, other->dependencies[d])
/* Let's now iterate through the dependencies of that dependencies of the other units,
* looking for pointers back, and let's fix them up, to instead point to 'u'. */
@@ -1216,7 +1212,6 @@ static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependency
void unit_dump(Unit *u, FILE *f, const char *prefix) {
char *t, **j;
- Iterator i;
const char *prefix2;
char timestamp[5][FORMAT_TIMESTAMP_MAX], timespan[FORMAT_TIMESPAN_MAX];
Unit *following;
@@ -1234,7 +1229,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
"%s-> Unit %s:\n",
prefix, u->id);
- SET_FOREACH(t, u->aliases, i)
+ SET_FOREACH(t, u->aliases)
fprintf(f, "%s\tAlias: %s\n", prefix, t);
fprintf(f,
@@ -1321,7 +1316,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
if (r >= 0) {
Unit *other;
- SET_FOREACH(other, following_set, i)
+ SET_FOREACH(other, following_set)
fprintf(f, "%s\tFollowing Set Member: %s\n", prefix, other->id);
}
@@ -1373,7 +1368,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
UnitDependencyInfo di;
Unit *other;
- HASHMAP_FOREACH_KEY(di.data, other, u->dependencies[d], i) {
+ HASHMAP_FOREACH_KEY(di.data, other, u->dependencies[d]) {
bool space = false;
fprintf(f, "%s\t%s: %s (", prefix, unit_dependency_to_string(d), other->id);
@@ -1389,7 +1384,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
UnitDependencyInfo di;
const char *path;
- HASHMAP_FOREACH_KEY(di.data, path, u->requires_mounts_for, i) {
+ HASHMAP_FOREACH_KEY(di.data, path, u->requires_mounts_for) {
bool space = false;
fprintf(f, "%s\tRequiresMountsFor: %s (", prefix, path);
@@ -1536,12 +1531,11 @@ static int unit_add_slice_dependencies(Unit *u) {
static int unit_add_mount_dependencies(Unit *u) {
UnitDependencyInfo di;
const char *path;
- Iterator i;
int r;
assert(u);
- HASHMAP_FOREACH_KEY(di.data, path, u->requires_mounts_for, i) {
+ HASHMAP_FOREACH_KEY(di.data, path, u->requires_mounts_for) {
char prefix[strlen(path) + 1];
PATH_FOREACH_PREFIX_MORE(prefix, path) {
@@ -1804,7 +1798,6 @@ bool unit_shall_confirm_spawn(Unit *u) {
static bool unit_verify_deps(Unit *u) {
Unit *other;
- Iterator j;
void *v;
assert(u);
@@ -1814,7 +1807,7 @@ static bool unit_verify_deps(Unit *u) {
* processing, but do not have any effect afterwards. We don't check BindsTo= dependencies that are not used in
* conjunction with After= as for them any such check would make things entirely racy. */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO], j) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO]) {
if (!hashmap_contains(u->dependencies[UNIT_AFTER], other))
continue;
@@ -2055,13 +2048,12 @@ bool unit_is_unneeded(Unit *u) {
for (size_t j = 0; j < ELEMENTSOF(deps); j++) {
Unit *other;
- Iterator i;
void *v;
/* If a dependent unit has a job queued, is active or transitioning, or is marked for
* restart, then don't clean this one up. */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[deps[j]], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[deps[j]]) {
if (other->job)
return false;
@@ -2091,10 +2083,9 @@ static void check_unneeded_dependencies(Unit *u) {
for (size_t j = 0; j < ELEMENTSOF(deps); j++) {
Unit *other;
- Iterator i;
void *v;
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[deps[j]], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[deps[j]])
unit_submit_to_stop_when_unneeded_queue(other);
}
}
@@ -2103,7 +2094,6 @@ static void unit_check_binds_to(Unit *u) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
bool stop = false;
Unit *other;
- Iterator i;
void *v;
int r;
@@ -2115,7 +2105,7 @@ static void unit_check_binds_to(Unit *u) {
if (unit_active_state(u) != UNIT_ACTIVE)
return;
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO]) {
if (other->job)
continue;
@@ -2151,54 +2141,51 @@ static void unit_check_binds_to(Unit *u) {
}
static void retroactively_start_dependencies(Unit *u) {
- Iterator i;
Unit *other;
void *v;
assert(u);
assert(UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u)));
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REQUIRES], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_REQUIRES])
if (!hashmap_get(u->dependencies[UNIT_AFTER], other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, NULL, NULL, NULL);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BINDS_TO])
if (!hashmap_get(u->dependencies[UNIT_AFTER], other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, NULL, NULL, NULL);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_WANTS], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_WANTS])
if (!hashmap_get(u->dependencies[UNIT_AFTER], other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_START, other, JOB_FAIL, NULL, NULL, NULL);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_CONFLICTS], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_CONFLICTS])
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL, NULL);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_CONFLICTED_BY], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_CONFLICTED_BY])
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL, NULL);
}
static void retroactively_stop_dependencies(Unit *u) {
Unit *other;
- Iterator i;
void *v;
assert(u);
assert(UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)));
/* Pull down units which are bound to us recursively if enabled */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BOUND_BY], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_BOUND_BY])
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, NULL, NULL, NULL);
}
void unit_start_on_failure(Unit *u) {
Unit *other;
- Iterator i;
void *v;
int r;
@@ -2209,7 +2196,7 @@ void unit_start_on_failure(Unit *u) {
log_unit_info(u, "Triggering OnFailure= dependencies.");
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_ON_FAILURE], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_ON_FAILURE]) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, NULL, &error, NULL);
@@ -2220,12 +2207,11 @@ void unit_start_on_failure(Unit *u) {
void unit_trigger_notify(Unit *u) {
Unit *other;
- Iterator i;
void *v;
assert(u);
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_TRIGGERED_BY], i)
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_TRIGGERED_BY])
if (UNIT_VTABLE(other)->trigger_notify)
UNIT_VTABLE(other)->trigger_notify(other, u);
}
@@ -2820,7 +2806,6 @@ void unit_unwatch_all_pids(Unit *u) {
static void unit_tidy_watch_pids(Unit *u) {
pid_t except1, except2;
- Iterator i;
void *e;
assert(u);
@@ -2830,7 +2815,7 @@ static void unit_tidy_watch_pids(Unit *u) {
except1 = unit_main_pid(u);
except2 = unit_control_pid(u);
- SET_FOREACH(e, u->pids, i) {
+ SET_FOREACH(e, u->pids) {
pid_t pid = PTR_TO_PID(e);
if (pid == except1 || pid == except2)
@@ -5102,7 +5087,6 @@ int unit_setup_exec_runtime(Unit *u) {
ExecRuntime **rt;
size_t offset;
Unit *other;
- Iterator i;
void *v;
int r;
@@ -5115,7 +5099,7 @@ int unit_setup_exec_runtime(Unit *u) {
return 0;
/* Try to get it from somebody else */
- HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_JOINS_NAMESPACE_OF], i) {
+ HASHMAP_FOREACH_KEY(v, other, u->dependencies[UNIT_JOINS_NAMESPACE_OF]) {
r = exec_runtime_acquire(u->manager, NULL, other->id, false, rt);
if (r == 1)
return 1;
@@ -5518,11 +5502,10 @@ void unit_remove_dependencies(Unit *u, UnitDependencyMask mask) {
do {
UnitDependencyInfo di;
Unit *other;
- Iterator i;
done = true;
- HASHMAP_FOREACH_KEY(di.data, other, u->dependencies[d], i) {
+ HASHMAP_FOREACH_KEY(di.data, other, u->dependencies[d]) {
if ((di.origin_mask & ~mask) == di.origin_mask)
continue;
di.origin_mask &= ~mask;