diff options
author | Tom Gundersen <teg@jklm.no> | 2014-07-28 12:21:51 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-07-28 12:21:51 +0200 |
commit | 16aa63a00b5b1db23a9c0b8de350ebf482d90cd0 (patch) | |
tree | c6284cb5d0d56d0d2ec61138da8de37fdd97e076 /src/network | |
parent | 6a0a2f860f1ca4a10932da3b41dbc3c0139757cc (diff) |
networkd: route/address - use trivial hash functions
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-address.c | 8 | ||||
-rw-r--r-- | src/network/networkd-network.c | 4 | ||||
-rw-r--r-- | src/network/networkd-route.c | 10 | ||||
-rw-r--r-- | src/network/networkd.h | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 551c1ea9bf..539bd98b52 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -41,8 +41,7 @@ int address_new_static(Network *network, unsigned section, Address **ret) { _cleanup_address_free_ Address *address = NULL; if (section) { - uint64_t key = section; - address = hashmap_get(network->addresses_by_section, &key); + address = hashmap_get(network->addresses_by_section, UINT_TO_PTR(section)); if (address) { *ret = address; address = NULL; @@ -63,7 +62,8 @@ int address_new_static(Network *network, unsigned section, Address **ret) { if (section) { address->section = section; - hashmap_put(network->addresses_by_section, &address->section, address); + hashmap_put(network->addresses_by_section, + UINT_TO_PTR(address->section), address); } *ret = address; @@ -96,7 +96,7 @@ void address_free(Address *address) { if (address->section) hashmap_remove(address->network->addresses_by_section, - &address->section); + UINT_TO_PTR(address->section)); } free(address); diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 7e753e15af..c99dab809b 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -66,11 +66,11 @@ static int network_load_one(Manager *manager, const char *filename) { if (!network->stacked_netdevs) return log_oom(); - network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func); + network->addresses_by_section = hashmap_new(NULL, NULL); if (!network->addresses_by_section) return log_oom(); - network->routes_by_section = hashmap_new(uint64_hash_func, uint64_compare_func); + network->routes_by_section = hashmap_new(NULL, NULL); if (!network->routes_by_section) return log_oom(); diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 00fd9528c4..f451b975a7 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -32,9 +32,8 @@ int route_new_static(Network *network, unsigned section, Route **ret) { _cleanup_route_free_ Route *route = NULL; if (section) { - uint64_t key = section; - - route = hashmap_get(network->routes_by_section, &key); + route = hashmap_get(network->routes_by_section, + UINT_TO_PTR(section)); if (route) { *ret = route; route = NULL; @@ -57,7 +56,8 @@ int route_new_static(Network *network, unsigned section, Route **ret) { if (section) { route->section = section; - hashmap_put(network->routes_by_section, &route->section, route); + hashmap_put(network->routes_by_section, + UINT_TO_PTR(route->section), route); } *ret = route; @@ -92,7 +92,7 @@ void route_free(Route *route) { if (route->section) hashmap_remove(route->network->routes_by_section, - &route->section); + UINT_TO_PTR(route->section)); } free(route); diff --git a/src/network/networkd.h b/src/network/networkd.h index bf73fe2bd5..766297cffa 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -110,7 +110,7 @@ struct Network { struct Address { Network *network; - uint64_t section; + unsigned section; int family; unsigned char prefixlen; @@ -128,7 +128,7 @@ struct Address { struct Route { Network *network; - uint64_t section; + unsigned section; int family; unsigned char dst_prefixlen; |