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.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/vector.h') 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); -- cgit v1.2.1