[quagga-dev 7803] [PATCH 2/2] Optimizaion of utility functions returning address family and sub-address family from current node.

Balaji G balajig81 at gmail.com
Sun Feb 21 11:15:57 GMT 2010


---
 bgpd/bgp_vty.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index eb9ec9a..0734a58 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -55,9 +55,8 @@ extern struct in_addr router_id_zebra;
 afi_t
 bgp_node_afi (struct vty *vty)
 {
-  if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
-    return AFI_IP6;
-  return AFI_IP;
+  return (((vty->node == BGP_IPV6_NODE)
+       || (vty->node == BGP_IPV6M_NODE)) ? AFI_IP6 : AFI_IP);
 }
 
 /* Utility function to get subsequent address family from current
@@ -65,11 +64,9 @@ bgp_node_afi (struct vty *vty)
 safi_t
 bgp_node_safi (struct vty *vty)
 {
-  if (vty->node == BGP_VPNV4_NODE)
-    return SAFI_MPLS_VPN;
-  if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
-    return SAFI_MULTICAST;
-  return SAFI_UNICAST;
+  return (((vty->node == BGP_VPNV4_NODE) ? SAFI_MPLS_VPN :
+	     ((vty->node == BGP_IPV4M_NODE) || vty->node == BGP_IPV6M_NODE)
+	     ? SAFI_MULTICAST : SAFI_UNICAST));
 }
 
 static int
-- 
1.6.6




More information about the Quagga-dev mailing list