From 5ac6fb7de10de5d84523c74f1d5fa0590a20f9f5 Mon Sep 17 00:00:00 2001 From: whd <7058128+superwhd@users.noreply.github.com> Date: Thu, 8 Jul 2021 03:47:28 +0800 Subject: [PATCH] [posix] remove constants defined by macros (#6795) --- src/posix/platform/netif.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/posix/platform/netif.cpp b/src/posix/platform/netif.cpp index 58f7513c7..55c7079aa 100644 --- a/src/posix/platform/netif.cpp +++ b/src/posix/platform/netif.cpp @@ -631,10 +631,6 @@ exit: } } -#define kAddAddress true -#define kRemoveAddress false -#define kUnicastAddress true -#define kMulticastAddress false static void logAddrEvent(bool isAdd, bool isUnicast, struct sockaddr_in6 &addr6, otError error) { char addressString[INET6_ADDRSTRLEN + 1]; @@ -711,7 +707,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct nlmsghdr *aNetli error = otIp6SubscribeMulticastAddress(aInstance, &addr); } - logAddrEvent(kAddAddress, !addr.IsMulticast(), addr6, error); + logAddrEvent(/* isAdd */ true, !addr.IsMulticast(), addr6, error); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; @@ -730,7 +726,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct nlmsghdr *aNetli error = otIp6UnsubscribeMulticastAddress(aInstance, &addr); } - logAddrEvent(kRemoveAddress, !addr.IsMulticast(), addr6, error); + logAddrEvent(/* isAdd */ false, !addr.IsMulticast(), addr6, error); if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; @@ -914,7 +910,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) if (subscribed) { - logAddrEvent(kAddAddress, kUnicastAddress, addr6, OT_ERROR_ALREADY); + logAddrEvent(/* isAdd */ true, /* isUnicast */ true, addr6, OT_ERROR_ALREADY); error = OT_ERROR_NONE; } else @@ -964,7 +960,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) else { error = otIp6AddUnicastAddress(aInstance, &netAddr); - logAddrEvent(kAddAddress, kUnicastAddress, addr6, error); + logAddrEvent(/* isAdd */ true, /* isUnicast */ true, addr6, error); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; @@ -979,7 +975,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) netAddr.mAddress = addr; error = otIp6SubscribeMulticastAddress(aInstance, &addr); - logAddrEvent(kAddAddress, kMulticastAddress, addr6, error); + logAddrEvent(/* isAdd */ true, /* isUnicast */ false, addr6, error); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; @@ -996,7 +992,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) if (!addr.IsMulticast()) { error = otIp6RemoveUnicastAddress(aInstance, &addr); - logAddrEvent(kRemoveAddress, kUnicastAddress, addr6, error); + logAddrEvent(/* isAdd */ false, /* isUnicast */ true, addr6, error); if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; @@ -1005,7 +1001,7 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) else { error = otIp6UnsubscribeMulticastAddress(aInstance, &addr); - logAddrEvent(kRemoveAddress, kMulticastAddress, addr6, error); + logAddrEvent(/* isAdd */ false, /* isUnicast */ false, addr6, error); if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE;