summaryrefslogtreecommitdiff
path: root/lib/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vector.h')
-rw-r--r--lib/vector.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/vector.h b/lib/vector.h
index 534def4f37..ae05d4d3e0 100644
--- a/lib/vector.h
+++ b/lib/vector.h
@@ -15,9 +15,26 @@ extern "C" {
/* struct for vector */
struct _vector {
- unsigned int active; /* number of active slots */
- unsigned int alloced; /* number of allocated slot */
+ /* active: index of last non-NULL item (+1)
+ * count: number of non-NULL items (+1)
+ *
+ * the two will be different if a slot is set to NULL (without pulling
+ * up later items in the array). Whether this happens depends on
+ * which vector functions are used. If no empty slots are used, the
+ * two fields will be identical.
+ *
+ * alloced: size of array pointed to by index. If this is 0, index
+ * points at a global variable rather than a malloc'd bit of memory.
+ * The vector code will convert to malloc'd memory if necessary to
+ * perform updates.
+ */
+ unsigned int active;
+ unsigned int alloced;
unsigned int count;
+
+ /* whether struct _vector itself is dynamically allocated */
+ bool dynamic;
+
void **index; /* index to data */
};
typedef struct _vector *vector;