From: Yu Watanabe Date: Tue, 29 Sep 2020 12:53:05 +0000 (+0900) Subject: network: slightly shorten nexthop_compare_func() X-Git-Tag: v247-rc1~117^2~113 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf5a228f7b17d73f1f49e07882ed87a1f7362c99;p=thirdparty%2Fsystemd.git network: slightly shorten nexthop_compare_func() --- diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 4f40883e543..03e4bd152a3 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -125,19 +125,10 @@ static int nexthop_compare_func(const NextHop *a, const NextHop *b) { if (r != 0) return r; - switch (a->family) { - case AF_INET: - case AF_INET6: + if (IN_SET(a->family, AF_INET, AF_INET6)) + return memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family)); - r = memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family)); - if (r != 0) - return r; - - return 0; - default: - /* treat any other address family as AF_UNSPEC */ - return 0; - } + return 0; } DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(