]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use siphash24_compress_string() where it is applicable
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 Jul 2020 19:54:37 +0000 (04:54 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Jul 2020 10:55:14 +0000 (19:55 +0900)
src/journal/catalog.c
src/network/networkd-ndisc.c
src/network/networkd-routing-policy-rule.c
src/network/networkd-util.c
src/resolve/resolved-dns-server.c

index 70b2c8b46c4e445821f87ac206d7eaaf855a424c..b2589271cacf2c0d6ff3014a6ebc429d653f2ead 100644 (file)
@@ -55,7 +55,7 @@ typedef struct CatalogItem {
 
 static void catalog_hash_func(const CatalogItem *i, struct siphash *state) {
         siphash24_compress(&i->id, sizeof(i->id), state);
-        siphash24_compress(i->language, strlen(i->language), state);
+        siphash24_compress_string(i->language, state);
 }
 
 static int catalog_compare_func(const CatalogItem *a, const CatalogItem *b) {
index 409db8c3c5ab23e79e08dd64019b2e495eb7755f..fb7fa98b2bd1e5ee5a6c858ddb3e9d16a57a1e11 100644 (file)
@@ -70,7 +70,7 @@ static int make_stableprivate_address(Link *link, const struct in6_addr *prefix,
 
         l = MAX(DIV_ROUND_UP(prefix_len, 8), 8);
         siphash24_compress(prefix, l, &state);
-        siphash24_compress(link->ifname, strlen(link->ifname), &state);
+        siphash24_compress_string(link->ifname, &state);
         siphash24_compress(&link->mac, sizeof(struct ether_addr), &state);
         siphash24_compress(&dad_counter, sizeof(uint8_t), &state);
 
@@ -577,7 +577,7 @@ static int ndisc_router_process_rdnss(Link *link, sd_ndisc_router *rt) {
 }
 
 static void ndisc_dnssl_hash_func(const NDiscDNSSL *x, struct siphash *state) {
-        siphash24_compress(NDISC_DNSSL_DOMAIN(x), strlen(NDISC_DNSSL_DOMAIN(x)), state);
+        siphash24_compress_string(NDISC_DNSSL_DOMAIN(x), state);
 }
 
 static int ndisc_dnssl_compare_func(const NDiscDNSSL *a, const NDiscDNSSL *b) {
index 9777e020ed2e4815653367a87ba2f5155c13429d..e06d4b070a1c9988f85db50bc8fe24b9f3879907 100644 (file)
@@ -132,11 +132,8 @@ static void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct
                 siphash24_compress(&rule->dport, sizeof(rule->dport), state);
                 siphash24_compress(&rule->uid_range, sizeof(rule->uid_range), state);
 
-                if (rule->iif)
-                        siphash24_compress(rule->iif, strlen(rule->iif), state);
-
-                if (rule->oif)
-                        siphash24_compress(rule->oif, strlen(rule->oif), state);
+                siphash24_compress_string(rule->iif, state);
+                siphash24_compress_string(rule->oif, state);
 
                 break;
         default:
index 43507d8c635e25b2e454cf493cef2d2ff98b7a20..ce9319d942a3aa450fe438484d7e5cbd1d2cbde8 100644 (file)
@@ -117,7 +117,7 @@ int kernel_route_expiration_supported(void) {
 }
 
 static void network_config_hash_func(const NetworkConfigSection *c, struct siphash *state) {
-        siphash24_compress(c->filename, strlen(c->filename), state);
+        siphash24_compress_string(c->filename, state);
         siphash24_compress(&c->line, sizeof(c->line), state);
 }
 
index c87026f434e81752375a35f04ea67fbdb237de1b..9c221e1989bd19b85a5140aa32a305ceca9a59e8 100644 (file)
@@ -627,8 +627,7 @@ static void dns_server_hash_func(const DnsServer *s, struct siphash *state) {
         siphash24_compress(&s->address, FAMILY_ADDRESS_SIZE(s->family), state);
         siphash24_compress(&s->port, sizeof(s->port), state);
         siphash24_compress(&s->ifindex, sizeof(s->ifindex), state);
-        if (s->server_name)
-                siphash24_compress(s->server_name, strlen(s->server_name), state);
+        siphash24_compress_string(s->server_name, state);
 }
 
 static int dns_server_compare_func(const DnsServer *x, const DnsServer *y) {