[Olsr-dev] [olsrd] [PATCH v1 20/29] gateway: simplify and inline olsr_find_gateway_entry

Ferry Huberts (spam-protected)
Tue Jul 24 18:09:09 CEST 2012


From: Ferry Huberts <(spam-protected)>

node2gateway already takes care of NULL

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

diff --git a/src/gateway.c b/src/gateway.c
index 7e52c46..ddbc741 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -131,11 +131,9 @@ olsr_trigger_inetgw_selection(bool ipv4, bool ipv6) {
  * @param originator
  * @return gateway_entry for corresponding router
  */
-static struct gateway_entry *
+static inline struct gateway_entry *
 olsr_find_gateway_entry(union olsr_ip_addr *originator) {
-  struct avl_node *node = avl_find(&gateway_tree, originator);
-
-  return node == NULL ? NULL : node2gateway(node);
+  return node2gateway(avl_find(&gateway_tree, originator));
 }
 
 static void cleanup_gateway_handler(void *ptr) {
-- 
1.7.10.4





More information about the Olsr-dev mailing list