summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
Diffstat (limited to 'xs_set.h')
-rw-r--r--xs_set.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/xs_set.h b/xs_set.h
index bd1b8ea..f97eb20 100644
--- a/xs_set.h
+++ b/xs_set.h
@@ -12,6 +12,7 @@ typedef struct _xs_set {
} xs_set;
void xs_set_init(xs_set *s);
+d_char *xs_set_result(xs_set *s);
void xs_set_free(xs_set *s);
int xs_set_add(xs_set *s, const char *data);
@@ -32,11 +33,21 @@ void xs_set_init(xs_set *s)
}
-void xs_set_free(xs_set *s)
-/* frees a set */
+d_char *xs_set_result(xs_set *s)
+/* returns the set as a list and frees it */
{
+ d_char *list = s->list;
+ s->list = NULL;
s->hash = xs_free(s->hash);
- s->list = xs_free(s->list);
+
+ return list;
+}
+
+
+void xs_set_free(xs_set *s)
+/* frees a set, dropping the list */
+{
+ free(xs_set_result(s));
}