summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
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)
22/* creates a new set with a maximum of size hashed data */ 22/* creates a new set with a maximum of size hashed data */
23{ 23{
24 int sz = sizeof(struct _xs_set) + sizeof(int) * elems; 24 int sz = sizeof(struct _xs_set) + sizeof(int) * elems;
25 xs_set *s = calloc(sz, 1); 25 xs_set *s = xs_realloc(NULL, sz);
26
27 memset(s, '\0', sz);
26 28
27 /* initialize */ 29 /* initialize */
28 s->elems = elems; 30 s->elems = elems;
@@ -35,8 +37,8 @@ xs_set *xs_set_new(int elems)
35void xs_set_free(xs_set *s) 37void xs_set_free(xs_set *s)
36/* frees a set */ 38/* frees a set */
37{ 39{
38 free(s->list); 40 xs_free(s->list);
39 free(s); 41 xs_free(s);
40} 42}
41 43
42 44