aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dynarr/daextend.c (renamed from lib/dynarr/dapush.c)6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/dynarr/dapush.c b/lib/dynarr/daextend.c
index 11fde1b..efa96d5 100644
--- a/lib/dynarr/dapush.c
+++ b/lib/dynarr/daextend.c
@@ -6,17 +6,17 @@
#include "dynarr.h"
void *
-(dapush)(void *da, void *x, size_t sz, size_t align)
+(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 > cpy.cap) {
+ 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 - sz, x, sz);
+ memcpy(cpy.buf + cpy.len * sz - n * sz, xs, n * sz);
return memcpy(da, &cpy, sizeof(cpy));
}