From fa870ab358ce94017228cdddf4697e041fc32531 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 25 Oct 2022 09:32:41 +0200 Subject: Backport from xs. --- xs_set.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xs_set.h') diff --git a/xs_set.h b/xs_set.h index 2beb454..0d76bed 100644 --- a/xs_set.h +++ b/xs_set.h @@ -22,7 +22,9 @@ xs_set *xs_set_new(int elems) /* creates a new set with a maximum of size hashed data */ { int sz = sizeof(struct _xs_set) + sizeof(int) * elems; - xs_set *s = calloc(sz, 1); + xs_set *s = xs_realloc(NULL, sz); + + memset(s, '\0', sz); /* initialize */ s->elems = elems; @@ -35,8 +37,8 @@ xs_set *xs_set_new(int elems) void xs_set_free(xs_set *s) /* frees a set */ { - free(s->list); - free(s); + xs_free(s->list); + xs_free(s); } -- cgit v1.2.3