rcx

library of miscellaneous bits of C code
git clone git://git.rr3.xyz/rcx
Log | Files | Refs | README | LICENSE

commit 34049bf63711ae6c17f03e2721055864a19ee917
parent ecaf1b9447edf746e3d092fd3d8fca9a2743b78a
Author: robert <robertrussell.72001@gmail.com>
Date:   Thu, 28 Jul 2022 14:21:15 -0700

Rename vector and deque ALLOC defs

This makes it clearer what type of allocator is expected.

Diffstat:
Minc/cext/deque.h | 4++--
Minc/cext/vector.h | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/inc/cext/deque.h b/inc/cext/deque.h @@ -9,7 +9,7 @@ #define DEQUE_STATIC #define METHOD(name, prefix) JOIN(JOIN(prefix,_),name) #define DEQUE_MIN_BITS 3 /* 1<<3 = 8 elements */ -#define DEQUE_ALLOC ereallocn +#define DEQUE_REALLOCN ereallocn #define DEQUE_FREE free #define DEQUE_TYPEDEF(D, T)\ @@ -59,7 +59,7 @@ int METHOD(reserve,##__VA_ARGS__)(D *d, usize n) { \ if (ncap == 0) \ return -1; /* Overflow */ \ } \ - T *narr = DEQUE_ALLOC(d->arr, ncap, sizeof *narr); \ + T *narr = DEQUE_REALLOCN(d->arr, ncap, sizeof *narr); \ if (!narr) \ return -1; \ if (d->l == d->cap) { \ diff --git a/inc/cext/vector.h b/inc/cext/vector.h @@ -17,7 +17,7 @@ typedef struct { #define VECTOR_STATIC #define METHOD(name, prefix) JOIN(JOIN(prefix,_),name) #define VECTOR_MIN_CAP 8 -#define VECTOR_ALLOC ereallocf +#define VECTOR_REALLOCF ereallocf #define VECTOR_FREE free #define VECTOR_DECLARE(T, ...)\ @@ -50,7 +50,7 @@ int METHOD(resize,##__VA_ARGS__)(T **v, usize cap) { \ cap = MAX(cap, VECTOR_MIN_CAP); \ vechdr *h = *v ? VECHDR(*v) : 0; \ usize len = h ? h->len : 0; \ - h = VECTOR_ALLOC(h, sizeof *h, cap, sizeof (*v)[0]); \ + h = VECTOR_REALLOCF(h, sizeof *h, cap, sizeof (*v)[0]); \ if (!h) \ return -1; \ h->len = MIN(len, cap); \