summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorBalaji.G <balajig81@gmail.com>2012-09-26 10:39:10 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2012-10-25 19:15:59 +0200
commit837d16ccbe0fca413f8927da6a34b1e97ccada8a (patch)
tree7aed5a517b619c03d11bf567f6a14cda6f8f5efe /zebra
parentisisd: don't overrun list of protocols (diff)
downloadfrr-837d16ccbe0fca413f8927da6a34b1e97ccada8a.tar.xz
frr-837d16ccbe0fca413f8927da6a34b1e97ccada8a.zip
*: use array_size() helper macro
Use the array_size() helper macro. Replaces several instances of local macros with the same definition. Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/main.c4
-rw-r--r--zebra/rt_netlink.c2
-rw-r--r--zebra/test_main.c2
-rw-r--r--zebra/zebra_rib.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 5b5265f27..50ac224e2 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -104,7 +104,7 @@ struct zebra_privs_t zserv_privs =
.vty_group = VTY_GROUP,
#endif
.caps_p = _caps_p,
- .cap_num_p = sizeof(_caps_p)/sizeof(_caps_p[0]),
+ .cap_num_p = array_size(_caps_p),
.cap_num_i = 0
};
@@ -313,7 +313,7 @@ main (int argc, char **argv)
zprivs_init (&zserv_privs);
/* Vty related initialize. */
- signal_init (zebrad.master, Q_SIGC(zebra_signals), zebra_signals);
+ signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
cmd_init (1);
vty_init (zebrad.master);
memory_init ();
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 15475e205..ab28ad271 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1985,7 +1985,7 @@ static void netlink_install_filter (int sock, __u32 pid)
};
struct sock_fprog prog = {
- .len = sizeof(filter) / sizeof(filter[0]),
+ .len = array_size(filter),
.filter = filter,
};
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 70a1a3a65..a9518637d 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -280,7 +280,7 @@ main (int argc, char **argv)
zebrad.master = thread_master_create ();
/* Vty related initialize. */
- signal_init (zebrad.master, Q_SIGC(zebra_signals), zebra_signals);
+ signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
cmd_init (1);
vty_init (zebrad.master);
memory_init ();
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index b8a47031f..0e29e616a 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1546,7 +1546,7 @@ rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
/* Set default distance by route type. */
if (distance == 0)
{
- if ((unsigned)type >= sizeof(route_info) / sizeof(route_info[0]))
+ if ((unsigned)type >= array_size(route_info))
distance = 150;
else
distance = route_info[type].distance;