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/resolve | |
parent | core/unit: reduce scope of variables (diff) | |
download | systemd-90e74a66e663f1776457d599cb7d5ce44785a56c.tar.xz systemd-90e74a66e663f1776457d599cb7d5ce44785a56c.zip |
tree-wide: define iterator inside of the macro
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-bus.c | 9 | ||||
-rw-r--r-- | src/resolve/resolved-dns-cache.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-dns-packet.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-dns-query.c | 9 | ||||
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-dns-scope.c | 13 | ||||
-rw-r--r-- | src/resolve/resolved-dns-server.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-dns-stream.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-dns-stub.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-dns-transaction.c | 36 | ||||
-rw-r--r-- | src/resolve/resolved-dns-trust-anchor.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-dns-zone.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-dnssd-bus.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-dnssd.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-link-bus.c | 6 | ||||
-rw-r--r-- | src/resolve/resolved-link.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-manager.c | 35 | ||||
-rw-r--r-- | src/resolve/resolved-resolv-conf.c | 6 |
18 files changed, 54 insertions, 105 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index 97cc125232..ca01e5f50b 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -1324,7 +1324,6 @@ static int bus_property_get_dns_servers_internal( Manager *m = userdata; DnsServer *s; - Iterator i; Link *l; int r; @@ -1341,7 +1340,7 @@ static int bus_property_get_dns_servers_internal( return r; } - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) LIST_FOREACH(servers, s, l->dns_servers) { r = bus_dns_server_append(reply, s, true, extended); if (r < 0) @@ -1477,7 +1476,6 @@ static int bus_property_get_domains( Manager *m = userdata; DnsSearchDomain *d; - Iterator i; Link *l; int r; @@ -1494,7 +1492,7 @@ static int bus_property_get_domains( return r; } - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { LIST_FOREACH(domains, d, l->search_domains) { r = sd_bus_message_append(reply, "(isb)", l->ifindex, d->name, d->route_only); if (r < 0) @@ -1581,7 +1579,6 @@ static int bus_property_get_ntas( Manager *m = userdata; const char *domain; - Iterator i; int r; assert(reply); @@ -1591,7 +1588,7 @@ static int bus_property_get_ntas( if (r < 0) return r; - SET_FOREACH(domain, m->trust_anchor.negative_by_name, i) { + SET_FOREACH(domain, m->trust_anchor.negative_by_name) { r = sd_bus_message_append(reply, "s", domain); if (r < 0) return r; diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c index 946889a834..683f113751 100644 --- a/src/resolve/resolved-dns-cache.c +++ b/src/resolve/resolved-dns-cache.c @@ -1015,14 +1015,13 @@ int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) { unsigned ancount = 0; - Iterator iterator; DnsCacheItem *i; int r; assert(cache); assert(p); - HASHMAP_FOREACH(i, cache->by_key, iterator) { + HASHMAP_FOREACH(i, cache->by_key) { DnsCacheItem *j; LIST_FOREACH(by_key, j, i) { @@ -1063,7 +1062,6 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) { } void dns_cache_dump(DnsCache *cache, FILE *f) { - Iterator iterator; DnsCacheItem *i; if (!cache) @@ -1072,7 +1070,7 @@ void dns_cache_dump(DnsCache *cache, FILE *f) { if (!f) f = stdout; - HASHMAP_FOREACH(i, cache->by_key, iterator) { + HASHMAP_FOREACH(i, cache->by_key) { DnsCacheItem *j; LIST_FOREACH(by_key, j, i) { diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index 63ede72473..75c8bf315e 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -354,7 +354,6 @@ static int dns_packet_extend(DnsPacket *p, size_t add, void **ret, size_t *start } void dns_packet_truncate(DnsPacket *p, size_t sz) { - Iterator i; char *s; void *n; @@ -363,7 +362,7 @@ void dns_packet_truncate(DnsPacket *p, size_t sz) { if (p->size <= sz) return; - HASHMAP_FOREACH_KEY(n, s, p->names, i) { + HASHMAP_FOREACH_KEY(n, s, p->names) { if (PTR_TO_SIZE(n) < sz) continue; @@ -646,7 +645,6 @@ fail: } static int dns_packet_append_types(DnsPacket *p, Bitmap *types, size_t *start) { - Iterator i; uint8_t window = 0; uint8_t entry = 0; uint8_t bitmaps[32] = {}; @@ -658,7 +656,7 @@ static int dns_packet_append_types(DnsPacket *p, Bitmap *types, size_t *start) { saved_size = p->size; - BITMAP_FOREACH(n, types, i) { + BITMAP_FOREACH(n, types) { assert(n <= 0xffff); if ((n >> 8) != window && bitmaps[entry / 8] != 0) { diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index 894b98834d..3afe4cf73b 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -129,14 +129,13 @@ static int dns_query_candidate_add_transaction(DnsQueryCandidate *c, DnsResource static int dns_query_candidate_go(DnsQueryCandidate *c) { DnsTransaction *t; - Iterator i; int r; unsigned n = 0; assert(c); /* Start the transactions that are not started yet */ - SET_FOREACH(t, c->transactions, i) { + SET_FOREACH(t, c->transactions) { if (t->state != DNS_TRANSACTION_NULL) continue; @@ -157,14 +156,13 @@ static int dns_query_candidate_go(DnsQueryCandidate *c) { static DnsTransactionState dns_query_candidate_state(DnsQueryCandidate *c) { DnsTransactionState state = DNS_TRANSACTION_NO_SERVERS; DnsTransaction *t; - Iterator i; assert(c); if (c->error_code != 0) return DNS_TRANSACTION_ERRNO; - SET_FOREACH(t, c->transactions, i) { + SET_FOREACH(t, c->transactions) { switch (t->state) { @@ -729,7 +727,6 @@ static void dns_query_accept(DnsQuery *q, DnsQueryCandidate *c) { bool has_authenticated = false, has_non_authenticated = false; DnssecResult dnssec_result_authenticated = _DNSSEC_RESULT_INVALID, dnssec_result_non_authenticated = _DNSSEC_RESULT_INVALID; DnsTransaction *t; - Iterator i; int r; assert(q); @@ -753,7 +750,7 @@ static void dns_query_accept(DnsQuery *q, DnsQueryCandidate *c) { q->answer_errno = c->error_code; } - SET_FOREACH(t, c->transactions, i) { + SET_FOREACH(t, c->transactions) { switch (t->state) { diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index fa43dd089d..63ed9ebf10 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -750,11 +750,10 @@ static int format_timestamp_dns(char *buf, size_t l, time_t sec) { static char *format_types(Bitmap *types) { _cleanup_strv_free_ char **strv = NULL; _cleanup_free_ char *str = NULL; - Iterator i; unsigned type; int r; - BITMAP_FOREACH(type, types, i) { + BITMAP_FOREACH(type, types) { if (dns_type_to_string(type)) { r = strv_extend(&strv, dns_type_to_string(type)); if (r < 0) diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index abf7b9122d..e69ba3c758 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -1218,7 +1218,6 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) { DnsTransaction *t; DnsZoneItem *z, *i; unsigned size = 0; - Iterator iterator; char *service_type; int r; @@ -1238,7 +1237,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) { return 0; /* we reach this point only if changing hostname didn't help */ /* Calculate answer's size. */ - HASHMAP_FOREACH(z, scope->zone.by_key, iterator) { + HASHMAP_FOREACH(z, scope->zone.by_key) { if (z->state != DNS_ZONE_ITEM_ESTABLISHED) continue; @@ -1270,7 +1269,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) { return log_oom(); /* Second iteration, actually add RRs to the answer. */ - HASHMAP_FOREACH(z, scope->zone.by_key, iterator) + HASHMAP_FOREACH(z, scope->zone.by_key) LIST_FOREACH (by_key, i, z) { DnsAnswerFlags flags; @@ -1288,7 +1287,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) { } /* Since all the active services are in the zone make them discoverable now. */ - SET_FOREACH(service_type, types, iterator) { + SET_FOREACH(service_type, types) { _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr; rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_PTR, @@ -1338,7 +1337,6 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) { } int dns_scope_add_dnssd_services(DnsScope *scope) { - Iterator i; DnssdService *service; DnssdTxtData *txt_data; int r; @@ -1350,7 +1348,7 @@ int dns_scope_add_dnssd_services(DnsScope *scope) { scope->announced = false; - HASHMAP_FOREACH(service, scope->manager->dnssd_services, i) { + HASHMAP_FOREACH(service, scope->manager->dnssd_services) { service->withdrawn = false; r = dns_zone_put(&scope->zone, scope, service->ptr_rr, false); @@ -1373,7 +1371,6 @@ int dns_scope_add_dnssd_services(DnsScope *scope) { int dns_scope_remove_dnssd_services(DnsScope *scope) { _cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL; - Iterator i; DnssdService *service; DnssdTxtData *txt_data; int r; @@ -1389,7 +1386,7 @@ int dns_scope_remove_dnssd_services(DnsScope *scope) { if (r < 0) return r; - HASHMAP_FOREACH(service, scope->manager->dnssd_services, i) { + HASHMAP_FOREACH(service, scope->manager->dnssd_services) { dns_zone_remove_rr(&scope->zone, service->ptr_rr); dns_zone_remove_rr(&scope->zone, service->srv_rr); LIST_FOREACH(items, txt_data, service->txt_data_items) diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index 9c221e1989..a5b89128c7 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -753,13 +753,12 @@ DnsServer *manager_get_dns_server(Manager *m) { if (!m->current_dns_server) { bool found = false; - Iterator i; /* No DNS servers configured, let's see if there are * any on any links. If not, we use the fallback * servers */ - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) if (l->dns_servers) { found = true; break; diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index 12f69aef38..a814de6a1f 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -455,7 +455,6 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use static DnsStream *dns_stream_free(DnsStream *s) { DnsPacket *p; - Iterator i; assert(s); @@ -471,7 +470,7 @@ static DnsStream *dns_stream_free(DnsStream *s) { dnstls_stream_free(s); #endif - ORDERED_SET_FOREACH(p, s->write_queue, i) + ORDERED_SET_FOREACH(p, s->write_queue) dns_packet_unref(ordered_set_remove(s->write_queue, p)); dns_packet_unref(s->write_packet); diff --git a/src/resolve/resolved-dns-stub.c b/src/resolve/resolved-dns-stub.c index 132bac8153..b09cbcff64 100644 --- a/src/resolve/resolved-dns-stub.c +++ b/src/resolve/resolved-dns-stub.c @@ -774,11 +774,10 @@ int manager_dns_stub_start(Manager *m) { if (!ordered_set_isempty(m->dns_extra_stub_listeners)) { DNSStubListenerExtra *l; - Iterator i; log_debug("Creating extra stub listeners."); - ORDERED_SET_FOREACH(l, m->dns_extra_stub_listeners, i) { + ORDERED_SET_FOREACH(l, m->dns_extra_stub_listeners) { if (FLAGS_SET(l->mode, DNS_STUB_LISTENER_UDP)) (void) manager_dns_stub_udp_fd_extra(m, l); if (FLAGS_SET(l->mode, DNS_STUB_LISTENER_TCP)) diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index cc833f72b9..36f57eae62 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -702,11 +702,10 @@ static void dns_transaction_cache_answer(DnsTransaction *t) { static bool dns_transaction_dnssec_is_live(DnsTransaction *t) { DnsTransaction *dt; - Iterator i; assert(t); - SET_FOREACH(dt, t->dnssec_transactions, i) + SET_FOREACH(dt, t->dnssec_transactions) if (DNS_TRANSACTION_IS_LIVE(dt->state)) return true; @@ -715,14 +714,13 @@ static bool dns_transaction_dnssec_is_live(DnsTransaction *t) { static int dns_transaction_dnssec_ready(DnsTransaction *t) { DnsTransaction *dt; - Iterator i; assert(t); /* Checks whether the auxiliary DNSSEC transactions of our transaction have completed, or are still * ongoing. Returns 0, if we aren't ready for the DNSSEC validation, positive if we are. */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { switch (dt->state) { @@ -1476,7 +1474,6 @@ static int dns_transaction_make_packet_mdns(DnsTransaction *t) { _cleanup_(dns_packet_unrefp) DnsPacket *p = NULL; bool add_known_answers = false; DnsTransaction *other; - Iterator i; DnsResourceKey *tkey; _cleanup_set_free_ Set *keys = NULL; unsigned qdcount; @@ -1585,7 +1582,7 @@ static int dns_transaction_make_packet_mdns(DnsTransaction *t) { return r; } - SET_FOREACH(tkey, keys, i) { + SET_FOREACH(tkey, keys) { _cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL; bool tentative; @@ -1774,7 +1771,6 @@ int dns_transaction_go(DnsTransaction *t) { static int dns_transaction_find_cyclic(DnsTransaction *t, DnsTransaction *aux) { DnsTransaction *n; - Iterator i; int r; assert(t); @@ -1785,7 +1781,7 @@ static int dns_transaction_find_cyclic(DnsTransaction *t, DnsTransaction *aux) { if (t == aux) return 1; - SET_FOREACH(n, aux->dnssec_transactions, i) { + SET_FOREACH(n, aux->dnssec_transactions) { r = dns_transaction_find_cyclic(t, n); if (r != 0) return r; @@ -1977,7 +1973,6 @@ static bool dns_transaction_dnssec_supported(DnsTransaction *t) { static bool dns_transaction_dnssec_supported_full(DnsTransaction *t) { DnsTransaction *dt; - Iterator i; assert(t); @@ -1986,7 +1981,7 @@ static bool dns_transaction_dnssec_supported_full(DnsTransaction *t) { if (!dns_transaction_dnssec_supported(t)) return false; - SET_FOREACH(dt, t->dnssec_transactions, i) + SET_FOREACH(dt, t->dnssec_transactions) if (!dns_transaction_dnssec_supported(dt)) return false; @@ -2380,11 +2375,10 @@ static int dns_transaction_requires_rrsig(DnsTransaction *t, DnsResourceRecord * case DNS_TYPE_SOA: case DNS_TYPE_NS: { DnsTransaction *dt; - Iterator i; /* For SOA or NS RRs we look for a matching DS transaction */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != rr->key->class) continue; @@ -2418,7 +2412,6 @@ static int dns_transaction_requires_rrsig(DnsTransaction *t, DnsResourceRecord * case DNS_TYPE_DNAME: { const char *parent = NULL; DnsTransaction *dt; - Iterator i; /* * CNAME/DNAME RRs cannot be located at a zone apex, hence look directly for the parent SOA. @@ -2426,7 +2419,7 @@ static int dns_transaction_requires_rrsig(DnsTransaction *t, DnsResourceRecord * * DS RRs are signed if the parent is signed, hence also look at the parent SOA */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != rr->key->class) continue; @@ -2462,11 +2455,10 @@ static int dns_transaction_requires_rrsig(DnsTransaction *t, DnsResourceRecord * default: { DnsTransaction *dt; - Iterator i; /* Any other kind of RR (including DNSKEY/NSEC/NSEC3). Let's see if our SOA lookup was authenticated */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != rr->key->class) continue; @@ -2494,7 +2486,6 @@ static int dns_transaction_requires_rrsig(DnsTransaction *t, DnsResourceRecord * static int dns_transaction_in_private_tld(DnsTransaction *t, const DnsResourceKey *key) { DnsTransaction *dt; const char *tld; - Iterator i; int r; /* If DNSSEC downgrade mode is on, checks whether the @@ -2530,7 +2521,7 @@ static int dns_transaction_in_private_tld(DnsTransaction *t, const DnsResourceKe if (!dns_name_is_single_label(tld)) return false; - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != key->class) continue; @@ -2556,7 +2547,6 @@ static int dns_transaction_requires_nsec(DnsTransaction *t) { DnsTransaction *dt; const char *name; uint16_t type = 0; - Iterator i; int r; assert(t); @@ -2614,7 +2604,7 @@ static int dns_transaction_requires_nsec(DnsTransaction *t) { /* For all other RRs we check the SOA on the same level to see * if it's signed. */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != t->key->class) continue; @@ -2651,7 +2641,6 @@ static int dns_transaction_dnskey_authenticated(DnsTransaction *t, DnsResourceRe DNS_ANSWER_FOREACH(rrsig, t->answer) { DnsTransaction *dt; - Iterator i; r = dnssec_key_match_rrsig(rr->key, rrsig); if (r < 0) @@ -2659,7 +2648,7 @@ static int dns_transaction_dnskey_authenticated(DnsTransaction *t, DnsResourceRe if (r == 0) continue; - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (dt->key->class != rr->key->class) continue; @@ -2771,14 +2760,13 @@ static int dns_transaction_invalidate_revoked_keys(DnsTransaction *t) { static int dns_transaction_copy_validated(DnsTransaction *t) { DnsTransaction *dt; - Iterator i; int r; assert(t); /* Copy all validated RRs from the auxiliary DNSSEC transactions into our set of validated RRs */ - SET_FOREACH(dt, t->dnssec_transactions, i) { + SET_FOREACH(dt, t->dnssec_transactions) { if (DNS_TRANSACTION_IS_LIVE(dt->state)) continue; diff --git a/src/resolve/resolved-dns-trust-anchor.c b/src/resolve/resolved-dns-trust-anchor.c index d68d0c3ba1..ad5061c2bd 100644 --- a/src/resolve/resolved-dns-trust-anchor.c +++ b/src/resolve/resolved-dns-trust-anchor.c @@ -464,7 +464,6 @@ static int domain_name_cmp(char * const *a, char * const *b) { static int dns_trust_anchor_dump(DnsTrustAnchor *d) { DnsAnswer *a; - Iterator i; assert(d); @@ -472,7 +471,7 @@ static int dns_trust_anchor_dump(DnsTrustAnchor *d) { log_info("No positive trust anchors defined."); else { log_info("Positive Trust Anchors:"); - HASHMAP_FOREACH(a, d->positive_by_key, i) { + HASHMAP_FOREACH(a, d->positive_by_key) { DnsResourceRecord *rr; DNS_ANSWER_FOREACH(rr, a) diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c index 33879d6142..f8e1491f8b 100644 --- a/src/resolve/resolved-dns-zone.c +++ b/src/resolve/resolved-dns-zone.c @@ -630,11 +630,10 @@ int dns_zone_verify_conflicts(DnsZone *zone, DnsResourceKey *key) { void dns_zone_verify_all(DnsZone *zone) { DnsZoneItem *i; - Iterator iterator; assert(zone); - HASHMAP_FOREACH(i, zone->by_key, iterator) { + HASHMAP_FOREACH(i, zone->by_key) { DnsZoneItem *j; LIST_FOREACH(by_key, j, i) @@ -643,7 +642,6 @@ void dns_zone_verify_all(DnsZone *zone) { } void dns_zone_dump(DnsZone *zone, FILE *f) { - Iterator iterator; DnsZoneItem *i; if (!zone) @@ -652,7 +650,7 @@ void dns_zone_dump(DnsZone *zone, FILE *f) { if (!f) f = stdout; - HASHMAP_FOREACH(i, zone->by_key, iterator) { + HASHMAP_FOREACH(i, zone->by_key) { DnsZoneItem *j; LIST_FOREACH(by_key, j, i) { diff --git a/src/resolve/resolved-dnssd-bus.c b/src/resolve/resolved-dnssd-bus.c index 33efb8ef06..7798746e67 100644 --- a/src/resolve/resolved-dnssd-bus.c +++ b/src/resolve/resolved-dnssd-bus.c @@ -14,7 +14,6 @@ int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_ DnssdService *s = userdata; DnssdTxtData *txt_data; Manager *m; - Iterator i; Link *l; int r; @@ -32,7 +31,7 @@ int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_ if (r == 0) return 1; /* Polkit will call us back */ - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { if (l->mdns_ipv4_scope) { r = dns_scope_announce(l->mdns_ipv4_scope, true); if (r < 0) @@ -91,7 +90,6 @@ static int dnssd_node_enumerator(sd_bus *bus, const char *path, void *userdata, _cleanup_strv_free_ char **l = NULL; Manager *m = userdata; DnssdService *service; - Iterator i; unsigned c = 0; int r; @@ -104,7 +102,7 @@ static int dnssd_node_enumerator(sd_bus *bus, const char *path, void *userdata, if (!l) return -ENOMEM; - HASHMAP_FOREACH(service, m->dnssd_services, i) { + HASHMAP_FOREACH(service, m->dnssd_services) { char *p; r = sd_bus_path_encode("/org/freedesktop/resolve1/dnssd", service->name, &p); diff --git a/src/resolve/resolved-dnssd.c b/src/resolve/resolved-dnssd.c index 4458ad1d2d..7d482ac5da 100644 --- a/src/resolve/resolved-dnssd.c +++ b/src/resolve/resolved-dnssd.c @@ -333,11 +333,10 @@ int dnssd_txt_item_new_from_data(const char *key, const void *data, const size_t } void dnssd_signal_conflict(Manager *manager, const char *name) { - Iterator i; DnssdService *s; int r; - HASHMAP_FOREACH(s, manager->dnssd_services, i) { + HASHMAP_FOREACH(s, manager->dnssd_services) { if (s->withdrawn) continue; diff --git a/src/resolve/resolved-link-bus.c b/src/resolve/resolved-link-bus.c index 42d4ae7aaf..3665d69f3c 100644 --- a/src/resolve/resolved-link-bus.c +++ b/src/resolve/resolved-link-bus.c @@ -222,7 +222,6 @@ static int property_get_ntas( Link *l = userdata; const char *name; - Iterator i; int r; assert(reply); @@ -232,7 +231,7 @@ static int property_get_ntas( if (r < 0) return r; - SET_FOREACH(name, l->dnssec_negative_trust_anchors, i) { + SET_FOREACH(name, l->dnssec_negative_trust_anchors) { r = sd_bus_message_append(reply, "s", name); if (r < 0) return r; @@ -746,7 +745,6 @@ static int link_node_enumerator(sd_bus *bus, const char *path, void *userdata, c _cleanup_strv_free_ char **l = NULL; Manager *m = userdata; Link *link; - Iterator i; unsigned c = 0; assert(bus); @@ -758,7 +756,7 @@ static int link_node_enumerator(sd_bus *bus, const char *path, void *userdata, c if (!l) return -ENOMEM; - HASHMAP_FOREACH(link, m->links, i) { + HASHMAP_FOREACH(link, m->links) { char *p; p = link_bus_path(link); diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index f52c556bd1..79d84dde1f 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -1250,11 +1250,10 @@ int link_save_user(Link *l) { if (!set_isempty(l->dnssec_negative_trust_anchors)) { bool space = false; - Iterator i; char *nta; fputs("NTAS=", f); - SET_FOREACH(nta, l->dnssec_negative_trust_anchors, i) { + SET_FOREACH(nta, l->dnssec_negative_trust_anchors) { if (space) fputc(' ', f); diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index ddd336b489..3e63f90dda 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -268,7 +268,6 @@ static int manager_rtnl_listen(Manager *m) { static int on_network_event(sd_event_source *s, int fd, uint32_t revents, void *userdata) { Manager *m = userdata; - Iterator i; Link *l; int r; @@ -276,7 +275,7 @@ static int on_network_event(sd_event_source *s, int fd, uint32_t revents, void * sd_network_monitor_flush(m->network_monitor); - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { r = link_update(l); if (r < 0) log_warning_errno(r, "Failed to update monitor information for %i: %m", l->ifindex); @@ -509,7 +508,6 @@ static int manager_sigusr1(sd_event_source *s, const struct signalfd_siginfo *si DnsServer *server; size_t size = 0; DnsScope *scope; - Iterator i; Link *l; assert(s); @@ -527,7 +525,7 @@ static int manager_sigusr1(sd_event_source *s, const struct signalfd_siginfo *si dns_server_dump(server, f); LIST_FOREACH(servers, server, m->fallback_dns_servers) dns_server_dump(server, f); - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) LIST_FOREACH(servers, server, l->dns_servers) dns_server_dump(server, f); @@ -1066,13 +1064,12 @@ int manager_send( uint32_t manager_find_mtu(Manager *m) { uint32_t mtu = 0; Link *l; - Iterator i; /* If we don't know on which link a DNS packet would be * delivered, let's find the largest MTU that works on all * interfaces we know of */ - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { if (l->mtu <= 0) continue; @@ -1096,7 +1093,6 @@ int manager_find_ifindex(Manager *m, int family, const union in_addr_union *in_a } void manager_refresh_rrs(Manager *m) { - Iterator i; Link *l; DnssdService *s; @@ -1108,11 +1104,11 @@ void manager_refresh_rrs(Manager *m) { m->mdns_host_ipv6_key = dns_resource_key_unref(m->mdns_host_ipv6_key); if (m->mdns_support == RESOLVE_SUPPORT_YES) - HASHMAP_FOREACH(s, m->dnssd_services, i) + HASHMAP_FOREACH(s, m->dnssd_services) if (dnssd_update_rrs(s) < 0) log_warning("Failed to refresh DNS-SD service '%s'", s->name); - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { link_add_rrs(l, true); link_add_rrs(l, false); } @@ -1180,12 +1176,11 @@ int manager_next_hostname(Manager *m) { } LinkAddress* manager_find_link_address(Manager *m, int family, const union in_addr_union *in_addr) { - Iterator i; Link *l; assert(m); - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { LinkAddress *a; a = link_find_address(l, family, in_addr); @@ -1272,7 +1267,6 @@ int manager_is_own_hostname(Manager *m, const char *name) { int manager_compile_dns_servers(Manager *m, OrderedSet **dns) { DnsServer *s; - Iterator i; Link *l; int r; @@ -1293,7 +1287,7 @@ int manager_compile_dns_servers(Manager *m, OrderedSet **dns) { } /* Then, add the per-link servers */ - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { LIST_FOREACH(servers, s, l->dns_servers) { r = ordered_set_put(*dns, s); if (r == -EEXIST) @@ -1324,7 +1318,6 @@ int manager_compile_dns_servers(Manager *m, OrderedSet **dns) { */ int manager_compile_search_domains(Manager *m, OrderedSet **domains, int filter_route) { DnsSearchDomain *d; - Iterator i; Link *l; int r; @@ -1348,7 +1341,7 @@ int manager_compile_search_domains(Manager *m, OrderedSet **domains, int filter_ return r; } - HASHMAP_FOREACH(l, m->links, i) { + HASHMAP_FOREACH(l, m->links) { LIST_FOREACH(domains, d, l->search_domains) { @@ -1378,7 +1371,6 @@ DnssecMode manager_get_dnssec_mode(Manager *m) { bool manager_dnssec_supported(Manager *m) { DnsServer *server; - Iterator i; Link *l; assert(m); @@ -1390,7 +1382,7 @@ bool manager_dnssec_supported(Manager *m) { if (server && !dns_server_dnssec_supported(server)) return false; - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) if (!link_dnssec_supported(l)) return false; @@ -1423,14 +1415,13 @@ void manager_dnssec_verdict(Manager *m, DnssecVerdict verdict, const DnsResource } bool manager_routable(Manager *m, int family) { - Iterator i; Link *l; assert(m); /* Returns true if the host has at least one interface with a routable address of the specified type */ - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) if (link_relevant(l, family, false)) return true; @@ -1449,13 +1440,12 @@ void manager_flush_caches(Manager *m) { } void manager_reset_server_features(Manager *m) { - Iterator i; Link *l; dns_server_reset_features_all(m->dns_servers); dns_server_reset_features_all(m->fallback_dns_servers); - HASHMAP_FOREACH(l, m->links, i) + HASHMAP_FOREACH(l, m->links) dns_server_reset_features_all(l->dns_servers); log_info("Resetting learnt feature levels on all servers."); @@ -1516,14 +1506,13 @@ void manager_cleanup_saved_user(Manager *m) { } bool manager_next_dnssd_names(Manager *m) { - Iterator i; DnssdService *s; bool tried = false; int r; assert(m); - HASHMAP_FOREACH(s, m->dnssd_services, i) { + HASHMAP_FOREACH(s, m->dnssd_services) { _cleanup_free_ char * new_name = NULL; if (!s->withdrawn) diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index befd8d7949..0de5046367 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -231,7 +231,6 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) { static void write_resolv_conf_search( OrderedSet *domains, FILE *f) { - Iterator i; char *domain; assert(domains); @@ -239,7 +238,7 @@ static void write_resolv_conf_search( fputs("search", f); - ORDERED_SET_FOREACH(domain, domains, i) { + ORDERED_SET_FOREACH(domain, domains) { fputc(' ', f); fputs(domain, f); } @@ -248,7 +247,6 @@ static void write_resolv_conf_search( } static int write_uplink_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet *domains) { - Iterator i; fputs("# This file is managed by man:systemd-resolved(8). Do not edit.\n" "#\n" @@ -269,7 +267,7 @@ static int write_uplink_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSe unsigned count = 0; DnsServer *s; - ORDERED_SET_FOREACH(s, dns, i) + ORDERED_SET_FOREACH(s, dns) write_resolv_conf_server(s, f, &count); } |