aboutsummaryrefslogtreecommitdiff
path: root/vector.inc.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-03-08 10:05:35 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-03-08 10:05:35 +0100
commit0dff6c5d179aeb9e1ba3fc5f4dd679987e342036 (patch)
treec43ef6a0ef0fe6f684928a226a0f439975b20e01 /vector.inc.h
parentWork on recuring event stream. (diff)
downloadcalp-0dff6c5d179aeb9e1ba3fc5f4dd679987e342036.tar.gz
calp-0dff6c5d179aeb9e1ba3fc5f4dd679987e342036.tar.xz
Remove C vector library.
Diffstat (limited to 'vector.inc.h')
-rw-r--r--vector.inc.h51
1 files changed, 0 insertions, 51 deletions
diff --git a/vector.inc.h b/vector.inc.h
deleted file mode 100644
index 2b23eadc..00000000
--- a/vector.inc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef TYPE
-#error "Set TYPE before including self file"
-#else
-
-#include "macro.h"
-#include "err.h"
-
-INIT_F(VECT(TYPE)) {
- self->length = 0;
- self->alloc = 1;
- self->items = (TYPE**) calloc(sizeof(*self->items), self->alloc);
- return 0;
-}
-
-FREE_F(VECT(TYPE)) {
- for (unsigned int i = 0; i < self->length; i++) {
- FFREE(TYPE, self->items[i]);
- }
- free(self->items);
- return 0;
-}
-
-int PUSH(VECT(TYPE))(VECT(TYPE)* self, TYPE* t) {
- if (self->length + 1 > self->alloc) {
- self->alloc <<= 1;
- self->items = (TYPE**) realloc(self->items, sizeof(*self->items) * self->alloc);
- }
-
- self->items[self->length] = t;
- ++self->length;
- return 0;
-}
-
-TYPE* GET(VECT(TYPE))(VECT(TYPE)* self, unsigned int idx) {
- if (idx >= self->length) {
- ERR("Index out of range");
- return NULL;
- }
-
- return self->items[idx];
-}
-
-int EMPTY(VECT(TYPE))(VECT(TYPE)* self) {
- return self->length == 0;
-}
-
-unsigned int SIZE(VECT(TYPE))(VECT(TYPE)* self) {
- return self->length;
-}
-
-#endif /* TYPE */