diff options
author | paul <paul> | 2005-03-14 20:19:01 +0000 |
---|---|---|
committer | paul <paul> | 2005-03-14 20:19:01 +0000 |
commit | 55468c86040081320f557b696e509b76ddfd6c83 (patch) | |
tree | 3ee726f155f8776d4a220997681d14c0b09addd0 | |
parent | 909a215508fd42473fcbe4f5292a59404e5473af (diff) |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/ChangeLog | 4 | ||||
-rw-r--r-- | lib/command.c | 104 | ||||
-rw-r--r-- | lib/routemap.c | 4 | ||||
-rw-r--r-- | lib/vector.c | 26 | ||||
-rw-r--r-- | lib/vector.h | 9 | ||||
-rw-r--r-- | lib/vty.c | 14 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 12 | ||||
-rw-r--r-- | ripd/rip_interface.c | 12 | ||||
-rw-r--r-- | ripngd/ripng_interface.c | 12 | ||||
-rw-r--r-- | vtysh/vtysh.c | 4 | ||||
-rw-r--r-- | vtysh/vtysh_config.c | 4 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 2 |
13 files changed, 114 insertions, 99 deletions
@@ -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 cd5cec77..1040868b 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 4586e673..64118103 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 @@ sort_node () 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 @@ cmd_free_strvec (vector v) 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 @@ cmd_cmdsize (vector strvec) 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 @@ cmd_filter_by_completion (char *command, vector v, unsigned int index) 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 @@ cmd_filter_by_completion (char *command, vector v, unsigned int index) 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 @@ cmd_filter_by_string (char *command, vector v, unsigned int index) 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 @@ cmd_filter_by_string (char *command, vector v, unsigned int index) 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 @@ is_cmd_ambiguous (char *command, vector v, int index, enum match_type type) 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 @@ cmd_unique_string (vector v, const char *str) 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 @@ desc_unique_string (vector v, const char *str) 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 @@ cmd_describe_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_describe_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_describe_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_describe_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_describe_command (vector vline, struct vty *vty, int *status) 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 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status) 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 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status) /* 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 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) 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 @@ cmd_execute_command_real (vector vline, struct vty *vty, /* 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 @@ cmd_execute_command_real (vector vline, struct vty *vty, 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 @@ cmd_execute_command_real (vector vline, struct vty *vty, 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 @@ cmd_execute_command_real (vector vline, struct vty *vty, { 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 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, 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 @@ cmd_execute_command_strict (vector vline, struct vty *vty, /* 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 @@ cmd_execute_command_strict (vector vline, struct vty *vty, 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 @@ cmd_execute_command_strict (vector vline, struct vty *vty, 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 @@ cmd_execute_command_strict (vector vline, struct vty *vty, { 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 @@ DEFUN (config_list, 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 @@ DEFUN (config_write_file, 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 @@ DEFUN (config_write_terminal, 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 @@ DEFUN (config_write_terminal, 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 cc63e3a1..2906a52e 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -429,7 +429,7 @@ route_map_lookup_match (const char *name) 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 @@ route_map_lookup_set (const char *name) 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 31cdc77d..7c148628 100644 --- a/lib/vector.c +++ b/lib/vector.c @@ -35,7 +35,7 @@ vector_init (unsigned int size) 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 @@ vector_copy (vector v) 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 @@ vector_empty_slot (vector v) { 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 @@ vector_set (vector v, void *val) 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 @@ vector_set_index (vector v, unsigned int i, void *val) 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 @@ vector_set_index (vector v, unsigned int i, void *val) 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 @@ vector_unset (vector v, unsigned int i) 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 @@ vector_count (vector v) 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 7e00c397..deaf6a87 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 @@ typedef struct _vector *vector; /* (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); @@ -975,7 +975,7 @@ vty_describe_command (struct vty *vty) /* 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 @@ vty_describe_command (struct vty *vty) 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 @@ vty_log (const char *level, const char *proto_str, 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 @@ vty_log_fixed (const char *buf, size_t len) 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 @@ DEFUN (config_who, 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 @@ vty_reset () 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_reset () 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 5edee773..9ce0ac69 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -92,7 +92,7 @@ ospf6_get_lsa_handler (u_int16_t type) 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 @@ DEFUN (debug_ospf6_lsa_type, 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 @@ DEFUN (no_debug_ospf6_lsa_type, 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 @@ install_element_ospf6_debug_lsa () 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 @@ install_element_ospf6_debug_lsa () 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 @@ config_write_ospf6_debug_lsa (struct vty *vty) 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 68dcb01a..0a01d8b5 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -986,7 +986,7 @@ rip_enable_if_lookup (const char *ifname) 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_clean_network () } /* 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 @@ rip_passive_nondefault_lookup (const char *ifname) 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 @@ rip_passive_nondefault_clean () 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 @@ config_write_rip_network (struct vty *vty, int config_mode) 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 @@ config_write_rip_network (struct vty *vty, int config_mode) 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 bef7699a..5d317ee0 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -644,7 +644,7 @@ ripng_enable_if_lookup (const char *ifname) 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_clean_network () } /* 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 @@ ripng_passive_interface_lookup (const char *ifname) 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 @@ ripng_passive_interface_clean (void) 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 @@ ripng_network_write (struct vty *vty, int config_mode) } /* 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 @@ ripng_network_write (struct vty *vty, int config_mode) /* 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 fb41b0d1..5df562ca 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -587,7 +587,7 @@ vtysh_rl_describe (void) /* 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 @@ vtysh_rl_describe (void) 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 14efa486..fe8d52fb 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -309,7 +309,7 @@ vtysh_config_dump (FILE *fp) 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 @@ vtysh_config_dump (FILE *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_delete (master); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index f93f4235..8eb80619 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -105,7 +105,7 @@ vrf_lookup_by_name (char *name) 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; |