summaryrefslogtreecommitdiff
path: root/lib/vector.h
diff options
context:
space:
mode:
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);