diff options
author | Lars Hjemli | 2010-11-09 19:57:18 +0100 |
---|---|---|
committer | Lars Hjemli | 2010-11-10 00:22:41 +0100 |
commit | 958a95b37891098133369e835a2ab687e0dfa9dc (patch) | |
tree | 31bcd62973d381b072b91da15528c48c6fc14a41 /vector.h | |
parent | 52558a6d39d52e2b2968b622534b0ffa4da285cb (diff) | |
download | cgit-958a95b37891098133369e835a2ab687e0dfa9dc.tar.gz cgit-958a95b37891098133369e835a2ab687e0dfa9dc.tar.bz2 cgit-958a95b37891098133369e835a2ab687e0dfa9dc.zip |
Add vector utility functions
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'vector.h')
-rw-r--r-- | vector.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vector.h b/vector.h new file mode 100644 index 0000000..c64eb1f --- /dev/null +++ b/vector.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef CGIT_VECTOR_H | ||
2 | #define CGIT_VECTOR_H | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | |||
6 | struct vector { | ||
7 | size_t size; | ||
8 | size_t count; | ||
9 | size_t alloc; | ||
10 | void *data; | ||
11 | }; | ||
12 | |||
13 | #define VECTOR_INIT(type) {sizeof(type), 0, 0, NULL} | ||
14 | |||
15 | int vector_push(struct vector *vec, const void *data, int gently); | ||
16 | |||
17 | #endif /* CGIT_VECTOR_H */ | ||