libstrvec-c

C string vector library
git clone https://git.sinitax.com/sinitax/libstrvec-c
Log | Files | Refs | LICENSE | sfeed.txt

commit 6d7aef62de3dd6a5900816b002bf9304d763e052
parent 8240eff87bb928e12a093cc37aae78576cdf4f6c
Author: Louis Burda <quent.burda@gmail.com>
Date:   Sun, 21 May 2023 17:49:32 +0200

Update liballoc

Diffstat:
Msrc/strvec.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/strvec.c b/src/strvec.c @@ -40,13 +40,13 @@ strvec_alloc(size_t cap, struct allocator *allocator, int *_rc) rc = _rc ? _rc : &stub; - strvec = allocator->alloc(sizeof(struct strvec), rc); + strvec = allocator->alloc(allocator, sizeof(struct strvec), rc); if (!strvec && _rc) *rc = -*rc; if (!strvec) return NULL; *rc = strvec_init(strvec, cap, allocator); if (*rc) { - allocator->free(strvec); + allocator->free(allocator, strvec); return NULL; } @@ -67,7 +67,7 @@ strvec_free(struct strvec *strvec) LIBSTRVEC_ABORT_ON_ALLOC(rc < 0); if (rc) return rc; - rc = allocator->free(strvec); + rc = allocator->free(allocator, strvec); LIBSTRVEC_ABORT_ON_ALLOC(rc); if (rc) return -rc; @@ -88,7 +88,7 @@ strvec_copy(struct strvec *dst, struct strvec *src, for (DVEC_ITER(&dst->vec, str)) { if (!*str) continue; len = strlen(*str); - nstr = allocator->alloc(len + 1, &rc); + nstr = allocator->alloc(allocator, len + 1, &rc); LIBSTRVEC_ABORT_ON_ALLOC(!nstr); if (!nstr) return rc; strncpy(nstr, *str, len + 1);