mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Introduced `ARRAY_SIZE' macro to replace all the sizeof(a)/sizeof(*a) constructs.
This commit is contained in:
parent
dcab789047
commit
7750634946
@ -41,7 +41,7 @@ cmd_build_tree(void)
|
|||||||
|
|
||||||
cmd_root.plastson = &cmd_root.son;
|
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_info *cmd = &command_table[i];
|
||||||
struct cmd_node *old, *new;
|
struct cmd_node *old, *new;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL ((void *) 0)
|
#define NULL ((void *) 0)
|
||||||
|
@ -185,8 +185,7 @@ bgp_get_bucket(struct bgp_proto *p, ea_list *old, ea_list *tmp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that there are all mandatory attributes */
|
/* Ensure that there are all mandatory attributes */
|
||||||
/* FIXME: Introduce array size macro */
|
for(i=0; i<ARRAY_SIZE(bgp_mandatory_attrs); i++)
|
||||||
for(i=0; i<sizeof(bgp_mandatory_attrs)/sizeof(bgp_mandatory_attrs[0]); i++)
|
|
||||||
if (!(seen & (1 << 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);
|
log(L_ERR "%s: Mandatory attribute %s missing", p->p.name, bgp_attr_table[bgp_mandatory_attrs[i]].name);
|
||||||
|
Loading…
Reference in New Issue
Block a user