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;
#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)
}
/* 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);