summaryrefslogtreecommitdiff
path: root/lib/vector.h
diff options
context:
space:
mode:
authorpaul <paul>2005-03-14 20:19:01 +0000
committerpaul <paul>2005-03-14 20:19:01 +0000
commit55468c86040081320f557b696e509b76ddfd6c83 (patch)
tree3ee726f155f8776d4a220997681d14c0b09addd0 /lib/vector.h
parent909a215508fd42473fcbe4f5292a59404e5473af (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.
Diffstat (limited to 'lib/vector.h')
-rw-r--r--lib/vector.h9
1 files changed, 7 insertions, 2 deletions
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);