From 55468c86040081320f557b696e509b76ddfd6c83 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 14 Mar 2005 20:19:01 +0000 Subject: 2005-03-14 Paul Jakma * (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. --- lib/vector.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/vector.c') 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++; -- cgit v1.2.1