diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-09-03 10:46:52 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-09-11 21:36:11 +0200 |
commit | 967c84ebb0dff1cb020e3fec21a31fd8794698d7 (patch) | |
tree | cb2c975c71829eba9deb129ce24a73b660fe8b83 | |
parent | resolved: use dns_scope_ifindex() at more places (diff) | |
download | systemd-967c84ebb0dff1cb020e3fec21a31fd8794698d7.tar.xz systemd-967c84ebb0dff1cb020e3fec21a31fd8794698d7.zip |
resolved: simplify dns_scope_get_n_dns_servers(), don't count each time
-rw-r--r-- | src/resolve/resolved-dns-scope.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 58e08e8dc4..734728f905 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -138,23 +138,15 @@ DnsServer *dns_scope_get_dns_server(DnsScope *s) { } unsigned dns_scope_get_n_dns_servers(DnsScope *s) { - unsigned n = 0; - DnsServer *i; - assert(s); if (s->protocol != DNS_PROTOCOL_DNS) return 0; if (s->link) - i = s->link->dns_servers; + return s->link->n_dns_servers; else - i = s->manager->dns_servers; - - for (; i; i = i->servers_next) - n++; - - return n; + return s->manager->n_dns_servers; } void dns_scope_next_dns_server(DnsScope *s, DnsServer *if_current) { |