diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 11:58:29 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 12:14:05 +0200 |
commit | 90e74a66e663f1776457d599cb7d5ce44785a56c (patch) | |
tree | 16ce28594b8dc475e37df9a3b80accb96e748efa /src/home | |
parent | 12375b95ddcb7dbbcbc5969b87822d39115d8acf (diff) | |
download | systemd-90e74a66e663f1776457d599cb7d5ce44785a56c.tar.gz |
tree-wide: define iterator inside of the macro
Diffstat (limited to 'src/home')
-rw-r--r-- | src/home/homed-home-bus.c | 3 | ||||
-rw-r--r-- | src/home/homed-manager-bus.c | 9 | ||||
-rw-r--r-- | src/home/homed-manager.c | 6 | ||||
-rw-r--r-- | src/home/homed-varlink.c | 12 |
4 files changed, 10 insertions, 20 deletions
diff --git a/src/home/homed-home-bus.c b/src/home/homed-home-bus.c index 015eefb718..08f77b4f51 100644 --- a/src/home/homed-home-bus.c +++ b/src/home/homed-home-bus.c @@ -758,7 +758,6 @@ static int bus_home_node_enumerator( _cleanup_strv_free_ char **l = NULL; Manager *m = userdata; size_t k = 0; - Iterator i; Home *h; int r; @@ -768,7 +767,7 @@ static int bus_home_node_enumerator( if (!l) return -ENOMEM; - HASHMAP_FOREACH(h, m->homes_by_uid, i) { + HASHMAP_FOREACH(h, m->homes_by_uid) { r = bus_home_path(h, l + k); if (r < 0) return r; diff --git a/src/home/homed-manager-bus.c b/src/home/homed-manager-bus.c index ce6919a1a7..fa3acb5244 100644 --- a/src/home/homed-manager-bus.c +++ b/src/home/homed-manager-bus.c @@ -25,7 +25,6 @@ static int property_get_auto_login( sd_bus_error *error) { Manager *m = userdata; - Iterator i; Home *h; int r; @@ -37,7 +36,7 @@ static int property_get_auto_login( if (r < 0) return r; - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { _cleanup_(strv_freep) char **seats = NULL; _cleanup_free_ char *home_path = NULL; char **s; @@ -151,7 +150,6 @@ static int method_list_homes( _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = userdata; - Iterator i; Home *h; int r; @@ -166,7 +164,7 @@ static int method_list_homes( if (r < 0) return r; - HASHMAP_FOREACH(h, m->homes_by_uid, i) { + HASHMAP_FOREACH(h, m->homes_by_uid) { _cleanup_free_ char *path = NULL; r = bus_home_path(h, &path); @@ -560,7 +558,6 @@ static int method_lock_all_homes(sd_bus_message *message, void *userdata, sd_bus _cleanup_(operation_unrefp) Operation *o = NULL; bool waiting = false; Manager *m = userdata; - Iterator i; Home *h; int r; @@ -570,7 +567,7 @@ static int method_lock_all_homes(sd_bus_message *message, void *userdata, sd_bus * for every suitable home we have and only when all of them completed we send a reply indicating * completion. */ - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { /* Automatically suspend all homes that have at least one client referencing it that asked * for "please suspend", and no client that asked for "please do not suspend". */ diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 54761175c3..9ac375abd6 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -267,7 +267,6 @@ Manager* manager_free(Manager *m) { int manager_verify_user_record(Manager *m, UserRecord *hr) { EVP_PKEY *pkey; - Iterator i; int r; assert(m); @@ -298,7 +297,7 @@ int manager_verify_user_record(Manager *m, UserRecord *hr) { } } - HASHMAP_FOREACH(pkey, m->public_keys, i) { + HASHMAP_FOREACH(pkey, m->public_keys) { r = user_record_verify(hr, pkey); switch (r) { @@ -1606,9 +1605,8 @@ int manager_gc_images(Manager *m) { manager_revalidate_image(m, h); } else { /* Gc all */ - Iterator i; - HASHMAP_FOREACH(h, m->homes_by_name, i) + HASHMAP_FOREACH(h, m->homes_by_name) manager_revalidate_image(m, h); } diff --git a/src/home/homed-varlink.c b/src/home/homed-varlink.c index c5bbba6852..8131a16bc0 100644 --- a/src/home/homed-varlink.c +++ b/src/home/homed-varlink.c @@ -103,13 +103,12 @@ int vl_method_get_user_record(Varlink *link, JsonVariant *parameters, VarlinkMet else if (p.user_name) h = hashmap_get(m->homes_by_name, p.user_name); else { - Iterator i; /* If neither UID nor name was specified, then dump all homes. Do so with varlink_notify() * for all entries but the last, so that clients can stream the results, and easily process * them piecemeal. */ - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { if (!home_user_match_lookup_parameters(&p, h)) continue; @@ -219,9 +218,8 @@ int vl_method_get_group_record(Varlink *link, JsonVariant *parameters, VarlinkMe else if (p.group_name) h = hashmap_get(m->homes_by_name, p.group_name); else { - Iterator i; - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { if (!home_group_match_lookup_parameters(&p, h)) continue; @@ -315,9 +313,8 @@ int vl_method_get_memberships(Varlink *link, JsonVariant *parameters, VarlinkMet } else if (p.group_name) { const char *last = NULL; - Iterator i; - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { if (!strv_contains(h->record->member_of, p.group_name)) continue; @@ -337,9 +334,8 @@ int vl_method_get_memberships(Varlink *link, JsonVariant *parameters, VarlinkMet JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(p.group_name)))); } else { const char *last_user_name = NULL, *last_group_name = NULL; - Iterator i; - HASHMAP_FOREACH(h, m->homes_by_name, i) { + HASHMAP_FOREACH(h, m->homes_by_name) { char **j; STRV_FOREACH(j, h->record->member_of) { |