summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-03-23 14:53:58 +0100
committerDavid Lamparter <equinox@diac24.net>2019-04-18 12:44:29 +0200
commit7e3a1ec742fab489eceeb23869063ebdedad12ff (patch)
treece44ea349dcc36685c2d9569e3882e444f870691 /nhrpd
parentlib: move/redo some macros (diff)
downloadfrr-7e3a1ec742fab489eceeb23869063ebdedad12ff.tar.xz
frr-7e3a1ec742fab489eceeb23869063ebdedad12ff.zip
lib: ZEBRA_NUM_OF -> array_size
The latter is widely used, e.g. in the Linux kernel. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/nhrp_main.c2
-rw-r--r--nhrpd/nhrp_vc.c6
-rw-r--r--nhrpd/resolver.c2
-rw-r--r--nhrpd/zbuf.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c
index 9b8599ede..d7c485f0a 100644
--- a/nhrpd/nhrp_main.c
+++ b/nhrpd/nhrp_main.c
@@ -55,7 +55,7 @@ struct zebra_privs_t nhrpd_privs = {
.vty_group = VTY_GROUP,
#endif
.caps_p = _caps_p,
- .cap_num_p = ZEBRA_NUM_OF(_caps_p),
+ .cap_num_p = array_size(_caps_p),
};
static void parse_arguments(int argc, char **argv)
diff --git a/nhrpd/nhrp_vc.c b/nhrpd/nhrp_vc.c
index f92ea4ac9..fa3549f5e 100644
--- a/nhrpd/nhrp_vc.c
+++ b/nhrpd/nhrp_vc.c
@@ -102,7 +102,7 @@ int nhrp_vc_ipsec_updown(uint32_t child_id, struct nhrp_vc *vc)
{
char buf[2][SU_ADDRSTRLEN];
struct child_sa *sa = NULL, *lsa;
- uint32_t child_hash = child_id % ZEBRA_NUM_OF(childlist_head);
+ uint32_t child_hash = child_id % array_size(childlist_head);
int abort_migration = 0;
list_for_each_entry(lsa, &childlist_head[child_hash], childlist_entry)
@@ -202,7 +202,7 @@ void nhrp_vc_init(void)
size_t i;
nhrp_vc_hash = hash_create(nhrp_vc_key, nhrp_vc_cmp, "NHRP VC hash");
- for (i = 0; i < ZEBRA_NUM_OF(childlist_head); i++)
+ for (i = 0; i < array_size(childlist_head); i++)
list_init(&childlist_head[i]);
}
@@ -211,7 +211,7 @@ void nhrp_vc_reset(void)
struct child_sa *sa, *n;
size_t i;
- for (i = 0; i < ZEBRA_NUM_OF(childlist_head); i++) {
+ for (i = 0; i < array_size(childlist_head); i++) {
list_for_each_entry_safe(sa, n, &childlist_head[i],
childlist_entry)
nhrp_vc_ipsec_updown(sa->id, 0);
diff --git a/nhrpd/resolver.c b/nhrpd/resolver.c
index 830f0e1c8..64b16e7ee 100644
--- a/nhrpd/resolver.c
+++ b/nhrpd/resolver.c
@@ -171,7 +171,7 @@ static void ares_address_cb(void *arg, int status, int timeouts,
return;
}
- for (i = 0; i < ZEBRA_NUM_OF(addr) && he->h_addr_list[i] != NULL; i++) {
+ for (i = 0; i < array_size(addr) && he->h_addr_list[i] != NULL; i++) {
memset(&addr[i], 0, sizeof(addr[i]));
addr[i].sa.sa_family = he->h_addrtype;
switch (he->h_addrtype) {
diff --git a/nhrpd/zbuf.c b/nhrpd/zbuf.c
index c66229508..7f1475cc6 100644
--- a/nhrpd/zbuf.c
+++ b/nhrpd/zbuf.c
@@ -196,7 +196,7 @@ int zbufq_write(struct zbuf_queue *zbq, int fd)
iov[iovcnt++] = (struct iovec){
.iov_base = zb->head, .iov_len = zbuf_used(zb),
};
- if (iovcnt >= ZEBRA_NUM_OF(iov))
+ if (iovcnt >= array_size(iov))
break;
}