diff options
author | sanine <sanine.not@pm.me> | 2022-12-10 19:12:31 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-12-10 19:12:31 -0600 |
commit | 7c47f23ee92afa07c748700f1de22fd8b8ccf967 (patch) | |
tree | 4387add23b932b74c237128c579c4c2c9005262a /src/util.c | |
parent | 8bc49efb970ac44f17f6076bb16f1d0e712bd750 (diff) |
refactor: remove node.* and util.* and move 3rdparty libs into separate directory
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/util.c b/src/util.c deleted file mode 100644 index 7b8120b..0000000 --- a/src/util.c +++ /dev/null @@ -1,39 +0,0 @@ -#include <stdlib.h> - -#include <kalmia.h> -#include "util.h" - -void * kai_next_array_element(void **array, size_t *count, size_t *max, size_t sz) -{ - void *array_new = NULL; - if (*max == 0) { - array_new = malloc(sz); - *count = 1; - *max = 1; - } - else if (*count == *max) { - array_new = realloc(*array, 2*(*max)*sz); - *count += 1; - *max *= 2; - } - else { - array_new = *array; - *count += 1; - } - - if (array_new == NULL) - return NULL; - - *array = array_new; - return array_new + ((*count-1) * sz); -} - - -ka_node_t * kai_next_node(kalmia_t *k) -{ - return kai_next_array_element( - (void**) &(k->node), - &(k->n_nodes), &(k->n_nodes_max), - sizeof(ka_node_t) - ); -} |