diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-11 01:58:35 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-11 01:58:35 +0200 |
commit | 587ccc983cf36fb9e00aa10ac32b58d0205aa96a (patch) | |
tree | 2e570c81e6160c2c7be46b720b4deeb1e853087f /lib/dynarr | |
parent | 7d9c8cb5956cab41492c7b70011d7d637d4d2a4c (diff) |
Go back to macros only, but they work now!
Diffstat (limited to 'lib/dynarr')
-rw-r--r-- | lib/dynarr/daextend.c | 22 | ||||
-rw-r--r-- | lib/dynarr/dagrow.c | 17 |
2 files changed, 0 insertions, 39 deletions
diff --git a/lib/dynarr/daextend.c b/lib/dynarr/daextend.c deleted file mode 100644 index efa96d5..0000000 --- a/lib/dynarr/daextend.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <errno.h> -#include <stdbit.h> -#include <stdint.h> -#include <string.h> - -#include "dynarr.h" - -void * -(daextend)(void *da, void *xs, size_t n, size_t sz, size_t align) -{ - dynarr(uint8_t) cpy; - memcpy(&cpy, da, sizeof(cpy)); - - if ((cpy.len += n) > cpy.cap) { - size_t ncap = stdc_bit_ceil(cpy.len); - cpy.buf = cpy.alloc(cpy.ctx, cpy.buf, cpy.cap, ncap, sz, align); - cpy.cap = ncap; - } - - memcpy(cpy.buf + cpy.len * sz - n * sz, xs, n * sz); - return memcpy(da, &cpy, sizeof(cpy)); -} diff --git a/lib/dynarr/dagrow.c b/lib/dynarr/dagrow.c deleted file mode 100644 index 8273efe..0000000 --- a/lib/dynarr/dagrow.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <stdint.h> - -#include "dynarr.h" - -void * -(dagrow)(void *da, size_t n, size_t elemsz, size_t align) -{ - dynarr(uint8_t) cpy; - memcpy(&cpy, da, sizeof(cpy)); - - if (n > cpy.cap) { - cpy.buf = cpy.alloc(cpy.ctx, cpy.buf, cpy.cap, n, elemsz, align); - cpy.cap = n; - } - - return memcpy(da, &cpy, sizeof(cpy)); -} |