gateway: minor simplification in olsr_delete_gateway_entry
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 18 Oct 2012 08:57:13 +0000 (10:57 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 24 Oct 2012 12:17:49 +0000 (14:17 +0200)
Do an early return if the gw is NULL

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index d8c2fb2..098847f 100644 (file)
@@ -391,7 +391,11 @@ void olsr_delete_gateway_entry(union olsr_ip_addr *originator, uint8_t prefixlen
   struct gateway_entry *gw = node2gateway(avl_find(&gateway_tree, originator));
   bool change = false;
 
-  if (gw && (gw->cleanup_timer == NULL || gw->ipv4 || gw->ipv6)) {
+  if (!gw) {
+    return;
+  }
+
+  if (gw->cleanup_timer == NULL || gw->ipv4 || gw->ipv6) {
     /* found a gw and it wasn't deleted yet */
 
     if (olsr_cnf->ip_version == AF_INET && prefixlen == 0) {