[SLOF] [PATCH 5/6] net-snk: Simplify the ip6_is_multicast() function

Thomas Huth thuth at redhat.com
Thu Jan 14 10:10:38 AEDT 2016


Using a memcpy to just compare one byte looks very cumbersome.

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 clients/net-snk/app/netlib/ipv6.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clients/net-snk/app/netlib/ipv6.c b/clients/net-snk/app/netlib/ipv6.c
index 6bf507b..2d2d952 100644
--- a/clients/net-snk/app/netlib/ipv6.c
+++ b/clients/net-snk/app/netlib/ipv6.c
@@ -411,8 +411,7 @@ ip6_cmp (ip6_addr_t *ip_1, ip6_addr_t *ip_2)
 int
 ip6_is_multicast (ip6_addr_t * ip)
 {
-	uint8_t mc = 0xFF;
-	return ! memcmp(&ip->addr[0], &mc, 1);
+	return ip->addr[0] == 0xFF;
 }
 
 /**
-- 
1.8.3.1



More information about the SLOF mailing list