diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-16 22:32:23 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-19 08:33:33 +0900 |
commit | de010b0b2e50cf0b3837ce350b116bc92605f67a (patch) | |
tree | 226685fbb97461692562035501ebc21a314f718c /src/resolve | |
parent | 80a226b26b5e00a2ef9e85d1321da44cd14d051b (diff) | |
download | systemd-de010b0b2e50cf0b3837ce350b116bc92605f67a.tar.gz |
strv: make iterator in STRV_FOREACH() declaread in the loop
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolvectl.c | 9 | ||||
-rw-r--r-- | src/resolve/resolved-dns-trust-anchor.c | 1 | ||||
-rw-r--r-- | src/resolve/resolved-dnssd.c | 1 | ||||
-rw-r--r-- | src/resolve/resolved-etc-hosts.c | 3 | ||||
-rw-r--r-- | src/resolve/resolved-link-bus.c | 1 | ||||
-rw-r--r-- | src/resolve/resolved-link.c | 2 |
6 files changed, 1 insertions, 16 deletions
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 5b3ceeff36..96a505f5e1 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -705,7 +705,6 @@ invalid: static int verb_query(int argc, char **argv, void *userdata) { sd_bus *bus = userdata; - char **p; int q, r = 0; if (arg_type != 0) @@ -975,7 +974,6 @@ static int resolve_openpgp(sd_bus *bus, const char *address) { static int verb_openpgp(int argc, char **argv, void *userdata) { sd_bus *bus = userdata; - char **p; int q, r = 0; STRV_FOREACH(p, argv + 1) { @@ -1025,7 +1023,7 @@ static bool service_family_is_valid(const char *s) { static int verb_tlsa(int argc, char **argv, void *userdata) { sd_bus *bus = userdata; - char **p, **args = argv + 1; + char **args = argv + 1; const char *family = "tcp"; int q, r = 0; @@ -1389,7 +1387,6 @@ static int status_print_strv_ifindex(int ifindex, const char *ifname, char **p) printf("%s%nGlobal%n%s:", ansi_highlight(), &pos1, &pos2, ansi_normal()); size_t cols = columns(), position = pos2 - pos1 + 2; - char **i; STRV_FOREACH(i, p) { size_t our_len = utf8_console_width(*i); /* This returns -1 on invalid utf-8 (which shouldn't happen). @@ -2025,7 +2022,6 @@ static int verb_status(int argc, char **argv, void *userdata) { int r = 0; if (argc > 1) { - char **ifname; bool empty_line = false; STRV_FOREACH(ifname, argv + 1) { @@ -2049,7 +2045,6 @@ static int verb_status(int argc, char **argv, void *userdata) { static int call_dns(sd_bus *bus, char **dns, const BusLocator *locator, sd_bus_error *error, bool extended) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL; - char **p; int r; r = bus_message_new_method_call(bus, &req, locator, extended ? "SetLinkDNSEx" : "SetLinkDNS"); @@ -2157,7 +2152,6 @@ static int verb_dns(int argc, char **argv, void *userdata) { static int call_domain(sd_bus *bus, char **domain, const BusLocator *locator, sd_bus_error *error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL; - char **p; int r; r = bus_message_new_method_call(bus, &req, locator, "SetLinkDomains"); @@ -2454,7 +2448,6 @@ static int call_nta(sd_bus *bus, char **nta, const BusLocator *locator, sd_bus_ static int verb_nta(int argc, char **argv, void *userdata) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus *bus = userdata; - char **p; int r; bool clear; diff --git a/src/resolve/resolved-dns-trust-anchor.c b/src/resolve/resolved-dns-trust-anchor.c index b036aa402c..4a6c06d13d 100644 --- a/src/resolve/resolved-dns-trust-anchor.c +++ b/src/resolve/resolved-dns-trust-anchor.c @@ -409,7 +409,6 @@ static int dns_trust_anchor_load_files( int (*loader)(DnsTrustAnchor *d, const char *path, unsigned n, const char *line)) { _cleanup_strv_free_ char **files = NULL; - char **f; int r; assert(d); diff --git a/src/resolve/resolved-dnssd.c b/src/resolve/resolved-dnssd.c index 0e361122c4..6d77aa817e 100644 --- a/src/resolve/resolved-dnssd.c +++ b/src/resolve/resolved-dnssd.c @@ -186,7 +186,6 @@ int dnssd_render_instance_name(DnssdService *s, char **ret_name) { int dnssd_load(Manager *manager) { _cleanup_strv_free_ char **files = NULL; - char **f; int r; assert(manager); diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c index a8da6c3d88..72d6b42189 100644 --- a/src/resolve/resolved-etc-hosts.c +++ b/src/resolve/resolved-etc-hosts.c @@ -192,7 +192,6 @@ static void strip_localhost(EtcHosts *hosts) { for (size_t j = 0; j < ELEMENTSOF(local_in_addrs); j++) { bool all_localhost, in_order; - char **i; item = hashmap_get(hosts->by_address, local_in_addrs + j); if (!item) @@ -392,8 +391,6 @@ int manager_etc_hosts_lookup(Manager *m, DnsQuestion* q, DnsAnswer **answer) { } if (found_ptr) { - char **n; - r = dns_answer_reserve(answer, strv_length(item->names)); if (r < 0) return r; diff --git a/src/resolve/resolved-link-bus.c b/src/resolve/resolved-link-bus.c index 4358fc48b1..881b65bb26 100644 --- a/src/resolve/resolved-link-bus.c +++ b/src/resolve/resolved-link-bus.c @@ -704,7 +704,6 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v _cleanup_free_ char *j = NULL; Link *l = userdata; int r; - char **i; assert(message); assert(l); diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index d12e301891..8027eb6f91 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -283,7 +283,6 @@ static int link_update_dns_server_one(Link *l, const char *str) { static int link_update_dns_servers(Link *l) { _cleanup_strv_free_ char **nameservers = NULL; - char **nameserver; int r; assert(l); @@ -518,7 +517,6 @@ static int link_update_search_domain_one(Link *l, const char *name, bool route_o static int link_update_search_domains(Link *l) { _cleanup_strv_free_ char **sdomains = NULL, **rdomains = NULL; - char **i; int r, q; assert(l); |