0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

Introduced `ARRAY_SIZE' macro to replace all the sizeof(a)/sizeof(*a) constructs.

This commit is contained in:
Martin Mares 2000-04-12 13:21:23 +00:00
parent dcab789047
commit 7750634946
3 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ cmd_build_tree(void)
cmd_root.plastson = &cmd_root.son;
for(i=0; i<sizeof(command_table) / sizeof(struct cmd_info); i++)
for(i=0; i<ARRAY_SIZE(command_table); i++)
{
struct cmd_info *cmd = &command_table[i];
struct cmd_node *old, *new;

View File

@ -19,6 +19,7 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
#ifndef NULL
#define NULL ((void *) 0)

View File

@ -185,8 +185,7 @@ bgp_get_bucket(struct bgp_proto *p, ea_list *old, ea_list *tmp)
}
/* Ensure that there are all mandatory attributes */
/* FIXME: Introduce array size macro */
for(i=0; i<sizeof(bgp_mandatory_attrs)/sizeof(bgp_mandatory_attrs[0]); i++)
for(i=0; i<ARRAY_SIZE(bgp_mandatory_attrs); i++)
if (!(seen & (1 << bgp_mandatory_attrs[i])))
{
log(L_ERR "%s: Mandatory attribute %s missing", p->p.name, bgp_attr_table[bgp_mandatory_attrs[i]].name);