[Olsr-dev] [PATCH v2 4/7] gateway: minor simplification in olsr_delete_gateway_entry

Ferry Huberts (spam-protected)
Thu Oct 18 11:50:40 CEST 2012


From: Ferry Huberts <(spam-protected)>

Do an early return if the gw is NULL

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/gateway.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gateway.c b/src/gateway.c
index d8c2fb2..098847f 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -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) {
-- 
1.7.11.7





More information about the Olsr-dev mailing list