[Olsr-dev] [PATCH v1 2/9] linux: netlink_process_link: simplify NULL comparisons and add some braces

Ferry Huberts (spam-protected)
Wed Feb 10 14:35:41 CET 2016


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/linux/kernel_routes_nl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/linux/kernel_routes_nl.c b/src/linux/kernel_routes_nl.c
index eb33664..9687b3c 100644
--- a/src/linux/kernel_routes_nl.c
+++ b/src/linux/kernel_routes_nl.c
@@ -121,7 +121,7 @@ static void netlink_process_link(struct nlmsghdr *h)
   iface = if_ifwithindex(ifi->ifi_index);
   oif = NULL;
 
-  if (iface == NULL && (ifi->ifi_flags & IFF_UP) == IFF_UP) {
+  if (!iface && ((ifi->ifi_flags & IFF_UP) == IFF_UP)) {
     if (if_indextoname(ifi->ifi_index, namebuffer)) {
       if ((oif = olsrif_ifwithname(namebuffer)) != NULL) {
         /* try to take interface up, will trigger ifchange */
@@ -129,12 +129,12 @@ static void netlink_process_link(struct nlmsghdr *h)
       }
     }
   }
-  else if (iface != NULL && (ifi->ifi_flags & IFF_UP) == 0) {
+  else if (iface && ((ifi->ifi_flags & IFF_UP) == 0)) {
     /* try to take interface down, will trigger ifchange */
     olsr_remove_interface(iface->olsr_if);
   }
 
-  if (iface == NULL && oif == NULL) {
+  if (!iface && !oif) {
     /* this is not an OLSR interface */
     if ((ifi->ifi_flags & IFF_UP) != 0) {
       olsr_trigger_ifchange(ifi->ifi_index, NULL, IFCHG_IF_ADD);
-- 
2.5.0




More information about the Olsr-dev mailing list