summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-25 09:32:41 +0200
committerdefault <nobody@localhost>2022-10-25 09:32:41 +0200
commitfa870ab358ce94017228cdddf4697e041fc32531 (patch)
tree326d5a13a525531b4c5c243160d215d7c28263ae /xs_set.h
parentd2095105de3fe8c3397df7d46a9d61011b74c09e (diff)
Backport from xs.
Diffstat (limited to 'xs_set.h')
-rw-r--r--xs_set.h8
1 files changed, 5 insertions, 3 deletions
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);
}