diff options
author | default <nobody@localhost> | 2022-10-25 09:32:41 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-10-25 09:32:41 +0200 |
commit | fa870ab358ce94017228cdddf4697e041fc32531 (patch) | |
tree | 326d5a13a525531b4c5c243160d215d7c28263ae /xs_set.h | |
parent | d2095105de3fe8c3397df7d46a9d61011b74c09e (diff) |
Backport from xs.
Diffstat (limited to 'xs_set.h')
-rw-r--r-- | xs_set.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); } |