diff options
author | Balaji.G <balajig81@gmail.com> | 2012-09-26 14:09:10 +0530 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2012-10-25 10:15:59 -0700 |
commit | 837d16ccbe0fca413f8927da6a34b1e97ccada8a (patch) | |
tree | 7aed5a517b619c03d11bf567f6a14cda6f8f5efe /bgpd | |
parent | 655071f44aab42e89bcece3a93da456fdd0d913a (diff) |
*: 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 'bgpd')
-rw-r--r-- | bgpd/bgp_attr.c | 5 | ||||
-rw-r--r-- | bgpd/bgp_main.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_open.c | 8 |
3 files changed, 7 insertions, 10 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 2d82acc2..cdc99ab3 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -62,7 +62,7 @@ static const struct message attr_str [] = { BGP_ATTR_AS4_AGGREGATOR, "AS4_AGGREGATOR" }, { BGP_ATTR_AS_PATHLIMIT, "AS_PATHLIMIT" }, }; -static const int attr_str_max = sizeof(attr_str)/sizeof(attr_str[0]); +static const int attr_str_max = array_size(attr_str); static const struct message attr_flag_str[] = { @@ -72,8 +72,7 @@ static const struct message attr_flag_str[] = /* bgp_attr_flags_diagnose() relies on this bit being last in this list */ { BGP_ATTR_FLAG_EXTLEN, "Extended Length" }, }; -static const size_t attr_flag_str_max = - sizeof (attr_flag_str) / sizeof (attr_flag_str[0]); +static const size_t attr_flag_str_max = array_size(attr_flag_str); static struct hash *cluster_hash; diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 0f1d4829..1ff1ac95 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -135,7 +135,7 @@ struct zebra_privs_t bgpd_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, }; @@ -422,7 +422,7 @@ main (int argc, char **argv) /* Initializations. */ srand (time (NULL)); - signal_init (master, Q_SIGC(bgp_signals), bgp_signals); + signal_init (master, array_size(bgp_signals), bgp_signals); zprivs_init (&bgpd_privs); cmd_init (1); vty_init (master); diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 0326d01b..d045dde5 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -187,8 +187,7 @@ static const struct message orf_type_str[] = { ORF_TYPE_PREFIX, "Prefixlist" }, { ORF_TYPE_PREFIX_OLD, "Prefixlist (old)" }, }; -static const int orf_type_str_max - = sizeof(orf_type_str)/sizeof(orf_type_str[0]); +static const int orf_type_str_max = array_size(orf_type_str); static const struct message orf_mode_str[] = { @@ -196,8 +195,7 @@ static const struct message orf_mode_str[] = { ORF_MODE_SEND, "Send" }, { ORF_MODE_BOTH, "Both" }, }; -static const int orf_mode_str_max - = sizeof(orf_mode_str)/sizeof(orf_mode_str[0]); +static const int orf_mode_str_max = array_size(orf_mode_str); static int bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr) @@ -449,7 +447,7 @@ static const struct message capcode_str[] = { CAPABILITY_CODE_REFRESH_OLD, "Route Refresh (Old)" }, { CAPABILITY_CODE_ORF_OLD, "ORF (Old)" }, }; -static const int capcode_str_max = sizeof(capcode_str)/sizeof(capcode_str[0]); +static const int capcode_str_max = array_size(capcode_str); /* Minimum sizes for length field of each cap (so not inc. the header) */ static const size_t cap_minsizes[] = |