Rename IP and Ethernet equality checkers from _cmp to _eq

Functions ending in cmp are expected to return 0 on equality but these
return non-zero.

eth_addr_cmp -> eth_addr_eq

ip_addr_cmp -> ip_addr_eq
ip4_addr_cmp -> ip4_addr_eq
ip6_addr_cmp -> ip6_addr_eq

ip_addr_netcmp -> ip_addr_net_eq
ip4_addr_netcmp -> ip4_addr_net_eq
ip6_addr_netcmp -> ip6_addr_net_eq

ip_addr_cmp_zoneless -> ip_addr_zoneless_eq
ip6_addr_cmp_zoneless -> ip6_addr_zoneless_eq

ip6_addr_cmp_zone -> ip6_addr_zone_eq
ip6_addr_netcmp_zoneless -> ip6_addr_net_zoneless_eq
ip6_addr_nethostcmp -> ip6_addr_nethost_eq
ip6_addr_cmp_packed -> ip6_addr_packed_eq
ip6_addr_cmp_solicitednode -> ip6_addr_solicitednode_eq

All call sites have been changed, and fallback macros have been added to not
break external users.
This commit is contained in:
Erik Ekman
2020-07-07 16:55:52 +02:00
parent 047f3b3306
commit 264a5a3e97
41 changed files with 211 additions and 162 deletions

View File

@@ -32,8 +32,7 @@ START_TEST(test_dns_set_get_server)
dns_setserver(i, &server);
fail_unless(dns_getserver(i));
if (i < DNS_MAX_SERVERS) {
/* ip_addr_cmp returns 1 if they match. */
fail_unless(ip_addr_cmp(dns_getserver(i), &server) == 1);
fail_unless(ip_addr_eq(dns_getserver(i), &server) == 1);
} else {
fail_unless(ip_addr_isany(dns_getserver(i)));
}

View File

@@ -340,8 +340,8 @@ START_TEST(test_ip6_dest_unreachable_chained_pbuf)
fail_unless(cloned_pbuf);
fail_unless(cloned_pbuf->len == IP6_HLEN + ICMP6_HLEN + sizeof(udp_hdr) + sizeof(udp_payload));
outhdr = (struct ip6_hdr*) cloned_pbuf->payload;
fail_unless(ip6_addr_cmp_packed(ip_2_ip6(&my_addr), &outhdr->src, IP6_NO_ZONE));
fail_unless(ip6_addr_cmp_packed(ip_2_ip6(&peer_addr), &outhdr->dest, IP6_NO_ZONE));
fail_unless(ip6_addr_packed_eq(ip_2_ip6(&my_addr), &outhdr->src, IP6_NO_ZONE));
fail_unless(ip6_addr_packed_eq(ip_2_ip6(&peer_addr), &outhdr->dest, IP6_NO_ZONE));
icmpptr = &((u8_t*)cloned_pbuf->payload)[IP6_HLEN];
icmp6hdr = (struct icmp6_hdr*) icmpptr;
fail_unless(icmp6hdr->type == ICMP6_TYPE_DUR);