2005-03-14 Paul Jakma <paul.jakma@sun.com>
* (global) update all c files to match the lib/vector.h rename of
(struct vector).active to max, and vector_max macro to
vector_active.
* lib/vector.h: Rename to (struct vector).max to slightly less
confusing active, for the number of active slots, distinct from
allocated or active-and-not-empty. Rename vector_max to
vector_active for same reason.
diff --git a/ChangeLog b/ChangeLog
index f8b6bdf..44852b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-14 Paul Jakma <paul.jakma@sun.com>
+
+ * (global) update all c files to match the lib/vector.h rename of
+ (struct vector).active to max, and vector_max macro to
+ vector_active.
+
2005-03-12 Paul Jakma <paul.jakma@sun.com>
* configure.ac: Solaris 8 can use the newer lifreq based methods
diff --git a/lib/ChangeLog b/lib/ChangeLog
index cd5cec7..1040868 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -20,6 +20,10 @@
(cmd_execute_command_strict) Fixup vector loop to be conditional
on non-null slot.
(various) Fix indentation and other whitespace.
+ vector.h: Rename to (struct vector).max to slightly less confusing
+ active, for the number of active slots, distinct from allocated
+ or active-and-not-empty. Rename vector_max to vector_active
+ for same reason.
2005-03-09 Paul Jakma <paul.jakma@sun.com>
diff --git a/lib/command.c b/lib/command.c
index 4586e67..6411810 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1,5 +1,5 @@
/*
- $Id: command.c,v 1.45 2005/03/14 17:41:45 paul Exp $
+ $Id: command.c,v 1.46 2005/03/14 20:19:01 paul Exp $
Command interpreter routine for virtual terminal [aka TeletYpe]
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
@@ -216,20 +216,20 @@
vector descvec;
struct cmd_element *cmd_element;
- for (i = 0; i < vector_max (cmdvec); i++)
+ for (i = 0; i < vector_active (cmdvec); i++)
if ((cnode = vector_slot (cmdvec, i)) != NULL)
{
vector cmd_vector = cnode->cmd_vector;
- qsort (cmd_vector->index, vector_max (cmd_vector),
+ qsort (cmd_vector->index, vector_active (cmd_vector),
sizeof (void *), cmp_node);
- for (j = 0; j < vector_max (cmd_vector); j++)
+ for (j = 0; j < vector_active (cmd_vector); j++)
if ((cmd_element = vector_slot (cmd_vector, j)) != NULL
- && vector_max (cmd_element->strvec))
+ && vector_active (cmd_element->strvec))
{
descvec = vector_slot (cmd_element->strvec,
- vector_max (cmd_element->strvec) - 1);
- qsort (descvec->index, vector_max (descvec),
+ vector_active (cmd_element->strvec) - 1);
+ qsort (descvec->index, vector_active (descvec),
sizeof (void *), cmp_desc);
}
}
@@ -297,7 +297,7 @@
if (!v)
return;
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((cp = vector_slot (v, i)) != NULL)
XFREE (MTYPE_STRVEC, cp);
@@ -442,10 +442,10 @@
vector descvec;
struct desc *desc;
- for (i = 0; i < vector_max (strvec); i++)
+ for (i = 0; i < vector_active (strvec); i++)
if ((descvec = vector_slot (strvec, i)) != NULL)
{
- if ((vector_max (descvec)) == 1
+ if ((vector_active (descvec)) == 1
&& (desc = vector_slot (descvec, 0)) != NULL)
{
if (desc->cmd == NULL || CMD_OPTION (desc->cmd))
@@ -1126,10 +1126,10 @@
match_type = no_match;
/* If command and cmd_element string does not match set NULL to vector */
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((cmd_element = vector_slot (v, i)) != NULL)
{
- if (index >= vector_max (cmd_element->strvec))
+ if (index >= vector_active (cmd_element->strvec))
vector_slot (v, i) = NULL;
else
{
@@ -1138,7 +1138,7 @@
descvec = vector_slot (cmd_element->strvec, index);
- for (j = 0; j < vector_max (descvec); j++)
+ for (j = 0; j < vector_active (descvec); j++)
if ((desc = vector_slot (descvec, j)))
{
str = desc->cmd;
@@ -1241,12 +1241,12 @@
match_type = no_match;
/* If command and cmd_element string does not match set NULL to vector */
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((cmd_element = vector_slot (v, i)) != NULL)
{
/* If given index is bigger than max string vector of command,
set NULL */
- if (index >= vector_max (cmd_element->strvec))
+ if (index >= vector_active (cmd_element->strvec))
vector_slot (v, i) = NULL;
else
{
@@ -1255,7 +1255,7 @@
descvec = vector_slot (cmd_element->strvec, index);
- for (j = 0; j < vector_max (descvec); j++)
+ for (j = 0; j < vector_active (descvec); j++)
if ((desc = vector_slot (descvec, j)))
{
str = desc->cmd;
@@ -1347,14 +1347,14 @@
vector descvec;
struct desc *desc;
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((cmd_element = vector_slot (v, i)) != NULL)
{
int match = 0;
descvec = vector_slot (cmd_element->strvec, index);
- for (j = 0; j < vector_max (descvec); j++)
+ for (j = 0; j < vector_active (descvec); j++)
if ((desc = vector_slot (descvec, j)))
{
enum match_type ret;
@@ -1525,7 +1525,7 @@
unsigned int i;
char *match;
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((match = vector_slot (v, i)) != NULL)
if (strcmp (match, str) == 0)
return 0;
@@ -1540,7 +1540,7 @@
unsigned int i;
struct desc *desc;
- for (i = 0; i < vector_max (v); i++)
+ for (i = 0; i < vector_active (v); i++)
if ((desc = vector_slot (v, i)) != NULL)
if (strcmp (desc->cmd, str) == 0)
return 1;
@@ -1575,13 +1575,13 @@
static struct desc desc_cr = { "<cr>", "" };
/* Set index. */
- if (vector_max (vline) == 0)
+ if (vector_active (vline) == 0)
{
*status = CMD_ERR_NO_MATCH;
return NULL;
}
else
- index = vector_max (vline) - 1;
+ index = vector_active (vline) - 1;
/* Make copy vector of current node's command vector. */
cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node));
@@ -1602,13 +1602,13 @@
vector descvec;
unsigned int j, k;
- for (j = 0; j < vector_max (cmd_vector); j++)
+ for (j = 0; j < vector_active (cmd_vector); j++)
if ((cmd_element = vector_slot (cmd_vector, j)) != NULL
- && (vector_max (cmd_element->strvec)))
+ && (vector_active (cmd_element->strvec)))
{
descvec = vector_slot (cmd_element->strvec,
- vector_max (cmd_element->strvec) - 1);
- for (k = 0; k < vector_max (descvec); k++)
+ vector_active (cmd_element->strvec) - 1);
+ for (k = 0; k < vector_active (descvec); k++)
{
struct desc *desc = vector_slot (descvec, k);
vector_set (matchvec, desc);
@@ -1644,19 +1644,19 @@
match = cmd_filter_by_completion (command, cmd_vector, index);
/* Make description vector. */
- for (i = 0; i < vector_max (cmd_vector); i++)
+ for (i = 0; i < vector_active (cmd_vector); i++)
if ((cmd_element = vector_slot (cmd_vector, i)) != NULL)
{
const char *string = NULL;
vector strvec = cmd_element->strvec;
- /* if command is NULL, index may be equal to vector_max */
- if (command && index >= vector_max (strvec))
+ /* if command is NULL, index may be equal to vector_active */
+ if (command && index >= vector_active (strvec))
vector_slot (cmd_vector, i) = NULL;
else
{
/* Check if command is completed. */
- if (command == NULL && index == vector_max (strvec))
+ if (command == NULL && index == vector_active (strvec))
{
string = "<cr>";
if (!desc_unique_string (matchvec, string))
@@ -1668,7 +1668,7 @@
vector descvec = vector_slot (strvec, index);
struct desc *desc;
- for (j = 0; j < vector_max (descvec); j++)
+ for (j = 0; j < vector_active (descvec); j++)
if ((desc = vector_slot (descvec, j)))
{
string = cmd_entry_function_desc (command, desc->cmd);
@@ -1712,7 +1712,7 @@
shifted_vline = vector_init (vector_count(vline));
/* use memcpy? */
- for (index = 1; index < vector_max (vline); index++)
+ for (index = 1; index < vector_active (vline); index++)
{
vector_set_index (shifted_vline, index-1, vector_lookup(vline, index));
}
@@ -1778,13 +1778,13 @@
char *command;
int lcd;
- if (vector_max (vline) == 0)
+ if (vector_active (vline) == 0)
{
*status = CMD_ERR_NO_MATCH;
return NULL;
}
else
- index = vector_max (vline) - 1;
+ index = vector_active (vline) - 1;
/* First, filter by preceeding command string */
for (i = 0; i < index; i++)
@@ -1818,21 +1818,21 @@
matchvec = vector_init (INIT_MATCHVEC_SIZE);
/* Now we got into completion */
- for (i = 0; i < vector_max (cmd_vector); i++)
+ for (i = 0; i < vector_active (cmd_vector); i++)
if ((cmd_element = vector_slot (cmd_vector, i)))
{
const char *string;
vector strvec = cmd_element->strvec;
/* Check field length */
- if (index >= vector_max (strvec))
+ if (index >= vector_active (strvec))
vector_slot (cmd_vector, i) = NULL;
else
{
unsigned int j;
descvec = vector_slot (strvec, index);
- for (j = 0; j < vector_max (descvec); j++)
+ for (j = 0; j < vector_active (descvec); j++)
if ((desc = vector_slot (descvec, j)))
{
if ((string =
@@ -1892,7 +1892,7 @@
/* match_str = (char **) &lcdstr; */
/* Free matchvec. */
- for (i = 0; i < vector_max (matchvec); i++)
+ for (i = 0; i < vector_active (matchvec); i++)
{
if (vector_slot (matchvec, i))
XFREE (MTYPE_TMP, vector_slot (matchvec, i));
@@ -1934,7 +1934,7 @@
shifted_vline = vector_init (vector_count(vline));
/* use memcpy? */
- for (index = 1; index < vector_max (vline); index++)
+ for (index = 1; index < vector_active (vline); index++)
{
vector_set_index (shifted_vline, index-1, vector_lookup(vline, index));
}
@@ -1997,7 +1997,7 @@
/* Make copy of command elements. */
cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node));
- for (index = 0; index < vector_max (vline); index++)
+ for (index = 0; index < vector_active (vline); index++)
if ((command = vector_slot (vline, index)))
{
int ret;
@@ -2026,7 +2026,7 @@
matched_count = 0;
incomplete_count = 0;
- for (i = 0; i < vector_max (cmd_vector); i++)
+ for (i = 0; i < vector_active (cmd_vector); i++)
if ((cmd_element = vector_slot (cmd_vector, i)))
{
if (match == vararg_match || index >= cmd_element->cmdsize)
@@ -2062,7 +2062,7 @@
varflag = 0;
argc = 0;
- for (i = 0; i < vector_max (vline); i++)
+ for (i = 0; i < vector_active (vline); i++)
{
if (varflag)
argv[argc++] = vector_slot (vline, i);
@@ -2070,7 +2070,7 @@
{
vector descvec = vector_slot (matched_element->strvec, i);
- if (vector_max (descvec) == 1)
+ if (vector_active (descvec) == 1)
{
struct desc *desc = vector_slot (descvec, 0);
@@ -2117,7 +2117,7 @@
shifted_vline = vector_init (vector_count(vline));
/* use memcpy? */
- for (index = 1; index < vector_max (vline); index++)
+ for (index = 1; index < vector_active (vline); index++)
{
vector_set_index (shifted_vline, index-1, vector_lookup(vline, index));
}
@@ -2176,7 +2176,7 @@
/* Make copy of command element */
cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node));
- for (index = 0; index < vector_max (vline); index++)
+ for (index = 0; index < vector_active (vline); index++)
if ((command = vector_slot (vline, index)))
{
int ret;
@@ -2205,7 +2205,7 @@
matched_element = NULL;
matched_count = 0;
incomplete_count = 0;
- for (i = 0; i < vector_max (cmd_vector); i++)
+ for (i = 0; i < vector_active (cmd_vector); i++)
if (vector_slot (cmd_vector, i) != NULL)
{
cmd_element = vector_slot (cmd_vector, i);
@@ -2238,7 +2238,7 @@
varflag = 0;
argc = 0;
- for (i = 0; i < vector_max (vline); i++)
+ for (i = 0; i < vector_active (vline); i++)
{
if (varflag)
argv[argc++] = vector_slot (vline, i);
@@ -2246,7 +2246,7 @@
{
vector descvec = vector_slot (matched_element->strvec, i);
- if (vector_max (descvec) == 1)
+ if (vector_active (descvec) == 1)
{
struct desc *desc = vector_slot (descvec, 0);
@@ -2494,7 +2494,7 @@
struct cmd_node *cnode = vector_slot (cmdvec, vty->node);
struct cmd_element *cmd;
- for (i = 0; i < vector_max (cnode->cmd_vector); i++)
+ for (i = 0; i < vector_active (cnode->cmd_vector); i++)
if ((cmd = vector_slot (cnode->cmd_vector, i)) != NULL
&& !(cmd->attr == CMD_ATTR_DEPRECATED
|| cmd->attr == CMD_ATTR_HIDDEN))
@@ -2558,7 +2558,7 @@
vty_time_print (file_vty, 1);
vty_out (file_vty, "!\n");
- for (i = 0; i < vector_max (cmdvec); i++)
+ for (i = 0; i < vector_active (cmdvec); i++)
if ((node = vector_slot (cmdvec, i)) && node->func)
{
if ((*node->func) (file_vty))
@@ -2652,7 +2652,7 @@
if (vty->type == VTY_SHELL_SERV)
{
- for (i = 0; i < vector_max (cmdvec); i++)
+ for (i = 0; i < vector_active (cmdvec); i++)
if ((node = vector_slot (cmdvec, i)) && node->func && node->vtysh)
{
if ((*node->func) (vty))
@@ -2665,7 +2665,7 @@
VTY_NEWLINE);
vty_out (vty, "!%s", VTY_NEWLINE);
- for (i = 0; i < vector_max (cmdvec); i++)
+ for (i = 0; i < vector_active (cmdvec); i++)
if ((node = vector_slot (cmdvec, i)) && node->func)
{
if ((*node->func) (vty))
diff --git a/lib/routemap.c b/lib/routemap.c
index cc63e3a..2906a52 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -429,7 +429,7 @@
unsigned int i;
struct route_map_rule_cmd *rule;
- for (i = 0; i < vector_max (route_match_vec); i++)
+ for (i = 0; i < vector_active (route_match_vec); i++)
if ((rule = vector_slot (route_match_vec, i)) != NULL)
if (strcmp (rule->str, name) == 0)
return rule;
@@ -443,7 +443,7 @@
unsigned int i;
struct route_map_rule_cmd *rule;
- for (i = 0; i < vector_max (route_set_vec); i++)
+ for (i = 0; i < vector_active (route_set_vec); i++)
if ((rule = vector_slot (route_set_vec, i)) != NULL)
if (strcmp (rule->str, name) == 0)
return rule;
diff --git a/lib/vector.c b/lib/vector.c
index 31cdc77..7c14862 100644
--- a/lib/vector.c
+++ b/lib/vector.c
@@ -35,7 +35,7 @@
size = 1;
v->alloced = size;
- v->max = 0;
+ v->active = 0;
v->index = XCALLOC (MTYPE_VECTOR_INDEX, sizeof (void *) * size);
return v;
}
@@ -65,7 +65,7 @@
unsigned int size;
vector new = XCALLOC (MTYPE_VECTOR, sizeof (struct _vector));
- new->max = v->max;
+ new->active = v->active;
new->alloced = v->alloced;
size = sizeof (void *) * (v->alloced);
@@ -99,10 +99,10 @@
{
unsigned int i;
- if (v->max == 0)
+ if (v->active == 0)
return 0;
- for (i = 0; i < v->max; i++)
+ for (i = 0; i < v->active; i++)
if (v->index[i] == 0)
return i;
@@ -120,8 +120,8 @@
v->index[i] = val;
- if (v->max <= i)
- v->max = i + 1;
+ if (v->active <= i)
+ v->active = i + 1;
return i;
}
@@ -134,8 +134,8 @@
v->index[i] = val;
- if (v->max <= i)
- v->max = i + 1;
+ if (v->active <= i)
+ v->active = i + 1;
return i;
}
@@ -144,7 +144,7 @@
void *
vector_lookup (vector v, unsigned int i)
{
- if (i >= v->max)
+ if (i >= v->active)
return NULL;
return v->index[i];
}
@@ -166,10 +166,10 @@
v->index[i] = NULL;
- if (i + 1 == v->max)
+ if (i + 1 == v->active)
{
- v->max--;
- while (i && v->index[--i] == NULL && v->max--)
+ v->active--;
+ while (i && v->index[--i] == NULL && v->active--)
; /* Is this ugly ? */
}
}
@@ -181,7 +181,7 @@
unsigned int i;
unsigned count = 0;
- for (i = 0; i < v->max; i++)
+ for (i = 0; i < v->active; i++)
if (v->index[i] != NULL)
count++;
diff --git a/lib/vector.h b/lib/vector.h
index 7e00c39..deaf6a8 100644
--- a/lib/vector.h
+++ b/lib/vector.h
@@ -26,7 +26,7 @@
/* struct for vector */
struct _vector
{
- unsigned int max; /* max number of used slot */
+ unsigned int active; /* number of active slots */
unsigned int alloced; /* number of allocated slot */
void **index; /* index to data */
};
@@ -36,8 +36,13 @@
/* (Sometimes) usefull macros. This macro convert index expression to
array expression. */
+/* Reference slot at given index, caller must ensure slot is active */
#define vector_slot(V,I) ((V)->index[(I)])
-#define vector_max(V) ((V)->max)
+/* Number of active slots.
+ * Note that this differs from vector_count() as it the count returned
+ * will include any empty slots
+ */
+#define vector_active(V) ((V)->active)
/* Prototypes. */
vector vector_init (unsigned int size);
diff --git a/lib/vty.c b/lib/vty.c
index 89a941c..eca1523 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -975,7 +975,7 @@
/* Get width of command string. */
width = 0;
- for (i = 0; i < vector_max (describe); i++)
+ for (i = 0; i < vector_active (describe); i++)
if ((desc = vector_slot (describe, i)) != NULL)
{
unsigned int len;
@@ -995,7 +995,7 @@
desc_width = vty->width - (width + 6);
/* Print out description. */
- for (i = 0; i < vector_max (describe); i++)
+ for (i = 0; i < vector_active (describe); i++)
if ((desc = vector_slot (describe, i)) != NULL)
{
if (desc->cmd[0] == '\0')
@@ -2371,7 +2371,7 @@
unsigned int i;
struct vty *vty;
- for (i = 0; i < vector_max (vtyvec); i++)
+ for (i = 0; i < vector_active (vtyvec); i++)
if ((vty = vector_slot (vtyvec, i)) != NULL)
if (vty->monitor)
{
@@ -2394,7 +2394,7 @@
iov[1].iov_base = "\r\n";
iov[1].iov_len = 2;
- for (i = 0; i < vector_max (vtyvec); i++)
+ for (i = 0; i < vector_active (vtyvec); i++)
{
struct vty *vty;
if (((vty = vector_slot (vtyvec, i)) != NULL) && vty->monitor)
@@ -2490,7 +2490,7 @@
unsigned int i;
struct vty *v;
- for (i = 0; i < vector_max (vtyvec); i++)
+ for (i = 0; i < vector_active (vtyvec); i++)
if ((v = vector_slot (vtyvec, i)) != NULL)
vty_out (vty, "%svty[%d] connected from %s.%s",
v->config ? "*" : " ",
@@ -2771,7 +2771,7 @@
struct vty *vty;
struct thread *vty_serv_thread;
- for (i = 0; i < vector_max (vtyvec); i++)
+ for (i = 0; i < vector_active (vtyvec); i++)
if ((vty = vector_slot (vtyvec, i)) != NULL)
{
buffer_reset (vty->obuf);
@@ -2779,7 +2779,7 @@
vty_close (vty);
}
- for (i = 0; i < vector_max (Vvty_serv_thread); i++)
+ for (i = 0; i < vector_active (Vvty_serv_thread); i++)
if ((vty_serv_thread = vector_slot (Vvty_serv_thread, i)) != NULL)
{
thread_cancel (vty_serv_thread);
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 5edee77..9ce0ac6 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -92,7 +92,7 @@
struct ospf6_lsa_handler *handler = NULL;
unsigned int index = ntohs (type) & OSPF6_LSTYPE_FCODE_MASK;
- if (index >= vector_max (ospf6_lsa_handler_vector))
+ if (index >= vector_active (ospf6_lsa_handler_vector))
handler = &unknown_handler;
else
handler = vector_slot (ospf6_lsa_handler_vector, index);
@@ -760,7 +760,7 @@
type = val;
}
- for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++)
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
@@ -828,7 +828,7 @@
type = val;
}
- for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++)
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
@@ -889,7 +889,7 @@
str = &strbuf[strlen (strbuf)];
strncat (strbuf, "debug ospf6 lsa (", STRSIZE - strlen (strbuf));
- for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++)
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
@@ -911,7 +911,7 @@
strncat (docbuf, "Debug Link State Advertisements (LSAs)\n",
DOCSIZE - strlen (docbuf));
- for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++)
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
@@ -976,7 +976,7 @@
u_int i;
struct ospf6_lsa_handler *handler;
- for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++)
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 68dcb01..0a01d8b 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -986,7 +986,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (rip_enable_interface); i++)
+ for (i = 0; i < vector_active (rip_enable_interface); i++)
if ((str = vector_slot (rip_enable_interface, i)) != NULL)
if (strcmp (str, ifname) == 0)
return i;
@@ -1253,7 +1253,7 @@
}
/* rip_enable_interface. */
- for (i = 0; i < vector_max (rip_enable_interface); i++)
+ for (i = 0; i < vector_active (rip_enable_interface); i++)
if ((str = vector_slot (rip_enable_interface, i)) != NULL)
{
free (str);
@@ -1268,7 +1268,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (Vrip_passive_nondefault); i++)
+ for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL)
if (strcmp (str, ifname) == 0)
return i;
@@ -1342,7 +1342,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (Vrip_passive_nondefault); i++)
+ for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL)
{
free (str);
@@ -2123,7 +2123,7 @@
VTY_NEWLINE);
/* Interface name RIP enable statement. */
- for (i = 0; i < vector_max (rip_enable_interface); i++)
+ for (i = 0; i < vector_active (rip_enable_interface); i++)
if ((ifname = vector_slot (rip_enable_interface, i)) != NULL)
vty_out (vty, "%s%s%s",
config_mode ? " network " : " ",
@@ -2142,7 +2142,7 @@
if (config_mode) {
if (passive_default)
vty_out (vty, " passive-interface default%s", VTY_NEWLINE);
- for (i = 0; i < vector_max (Vrip_passive_nondefault); i++)
+ for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
if ((ifname = vector_slot (Vrip_passive_nondefault, i)) != NULL)
vty_out (vty, " %spassive-interface %s%s",
(passive_default ? "no " : ""), ifname, VTY_NEWLINE);
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index bef7699..5d317ee 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -644,7 +644,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (ripng_enable_if); i++)
+ for (i = 0; i < vector_active (ripng_enable_if); i++)
if ((str = vector_slot (ripng_enable_if, i)) != NULL)
if (strcmp (str, ifname) == 0)
return i;
@@ -851,7 +851,7 @@
}
/* ripng_enable_if */
- for (i = 0; i < vector_max (ripng_enable_if); i++)
+ for (i = 0; i < vector_active (ripng_enable_if); i++)
if ((str = vector_slot (ripng_enable_if, i)) != NULL) {
free (str);
vector_slot (ripng_enable_if, i) = NULL;
@@ -868,7 +868,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (Vripng_passive_interface); i++)
+ for (i = 0; i < vector_active (Vripng_passive_interface); i++)
if ((str = vector_slot (Vripng_passive_interface, i)) != NULL)
if (strcmp (str, ifname) == 0)
return i;
@@ -943,7 +943,7 @@
unsigned int i;
char *str;
- for (i = 0; i < vector_max (Vripng_passive_interface); i++)
+ for (i = 0; i < vector_active (Vripng_passive_interface); i++)
if ((str = vector_slot (Vripng_passive_interface, i)) != NULL)
{
free (str);
@@ -975,7 +975,7 @@
}
/* Write enable interface. */
- for (i = 0; i < vector_max (ripng_enable_if); i++)
+ for (i = 0; i < vector_active (ripng_enable_if); i++)
if ((ifname = vector_slot (ripng_enable_if, i)) != NULL)
vty_out (vty, "%s%s%s",
config_mode ? " network " : " ",
@@ -984,7 +984,7 @@
/* Write passive interface. */
if (config_mode)
- for (i = 0; i < vector_max (Vripng_passive_interface); i++)
+ for (i = 0; i < vector_active (Vripng_passive_interface); i++)
if ((ifname = vector_slot (Vripng_passive_interface, i)) != NULL)
vty_out (vty, " passive-interface %s%s", ifname, VTY_NEWLINE);
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index fb41b0d..5df562c 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -587,7 +587,7 @@
/* Get width of command string. */
width = 0;
- for (i = 0; i < vector_max (describe); i++)
+ for (i = 0; i < vector_active (describe); i++)
if ((desc = vector_slot (describe, i)) != NULL)
{
int len;
@@ -603,7 +603,7 @@
width = len;
}
- for (i = 0; i < vector_max (describe); i++)
+ for (i = 0; i < vector_active (describe); i++)
if ((desc = vector_slot (describe, i)) != NULL)
{
if (desc->cmd[0] == '\0')
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 14efa48..fe8d52f 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -309,7 +309,7 @@
fprintf (fp, "!\n");
fflush (fp);
- for (i = 0; i < vector_max (configvec); i++)
+ for (i = 0; i < vector_active (configvec); i++)
if ((master = vector_slot (configvec, i)) != NULL)
{
LIST_LOOP (master, config, nn)
@@ -335,7 +335,7 @@
}
}
- for (i = 0; i < vector_max (configvec); i++)
+ for (i = 0; i < vector_active (configvec); i++)
if ((master = vector_slot (configvec, i)) != NULL)
{
list_delete (master);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index f93f423..8eb8061 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -105,7 +105,7 @@
unsigned int i;
struct vrf *vrf;
- for (i = 0; i < vector_max (vrf_vector); i++)
+ for (i = 0; i < vector_active (vrf_vector); i++)
if ((vrf = vector_slot (vrf_vector, i)) != NULL)
if (vrf->name && name && strcmp (vrf->name, name) == 0)
return vrf;