Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ambrop72/badvpn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbroz Bizjak <ambrop7@gmail.com>2014-11-03 21:57:09 +0300
committerAmbroz Bizjak <ambrop7@gmail.com>2014-11-08 22:31:51 +0300
commit4e2829dc53e5da2e617e97ef8e13590dc36821f6 (patch)
tree7190208537a283fd6ab35553d8d33a9da4f572da /structure
parentc8df8836d3b7fdaa3de62fdea7e75a6acd0e24f5 (diff)
structure/Vector: Add _Count.
Diffstat (limited to 'structure')
-rw-r--r--structure/Vector_decl.h1
-rw-r--r--structure/Vector_footer.h1
-rw-r--r--structure/Vector_header.h1
-rw-r--r--structure/Vector_impl.h5
4 files changed, 8 insertions, 0 deletions
diff --git a/structure/Vector_decl.h b/structure/Vector_decl.h
index 593d1dd..c29be0b 100644
--- a/structure/Vector_decl.h
+++ b/structure/Vector_decl.h
@@ -37,6 +37,7 @@ typedef struct {
static int Vector_Init (Vector *o, size_t capacity) WARN_UNUSED;
static void Vector_Free (Vector *o);
+static size_t Vector_Count (Vector *o);
static VectorElem * Vector_Get (Vector *o, size_t index);
static int Vector_AllocAppend (Vector *o, size_t count, VectorElem **out_ptr) WARN_UNUSED;
static void Vector_DoAppend (Vector *o, size_t count);
diff --git a/structure/Vector_footer.h b/structure/Vector_footer.h
index 1739eab..df438af 100644
--- a/structure/Vector_footer.h
+++ b/structure/Vector_footer.h
@@ -34,6 +34,7 @@
#undef VectorElem
#undef Vector_Init
#undef Vector_Free
+#undef Vector_Count
#undef Vector_Get
#undef Vector_AllocAppend
#undef Vector_DoAppend
diff --git a/structure/Vector_header.h b/structure/Vector_header.h
index f4ced07..da9d188 100644
--- a/structure/Vector_header.h
+++ b/structure/Vector_header.h
@@ -35,6 +35,7 @@
#define VectorElem VECTOR_ELEM_TYPE
#define Vector_Init MERGE(VECTOR_NAME, _Init)
#define Vector_Free MERGE(VECTOR_NAME, _Free)
+#define Vector_Count MERGE(VECTOR_NAME, _Count)
#define Vector_Get MERGE(VECTOR_NAME, _Get)
#define Vector_AllocAppend MERGE(VECTOR_NAME, _AllocAppend)
#define Vector_DoAppend MERGE(VECTOR_NAME, _DoAppend)
diff --git a/structure/Vector_impl.h b/structure/Vector_impl.h
index f451c2b..84652cd 100644
--- a/structure/Vector_impl.h
+++ b/structure/Vector_impl.h
@@ -49,6 +49,11 @@ static void Vector_Free (Vector *o)
BFree(o->elems);
}
+static size_t Vector_Count (Vector *o)
+{
+ return o->count;
+}
+
static VectorElem * Vector_Get (Vector *o, size_t index)
{
ASSERT(index < o->capacity)