tree-wide: use siphash24_compress_string() where it is applicable

This commit is contained in:
Yu Watanabe
2020-07-22 19:55:14 +09:00
parent 1c568d65ac
commit f281fc1e95
5 changed files with 7 additions and 11 deletions
+1 -1
View 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) {
+2 -2
View 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) {
+2 -5
View 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:
+1 -1
View 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);
}
+1 -2
View 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) {