summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-11-28 12:19:57 +0100
committerdefault <nobody@localhost>2022-11-28 12:19:57 +0100
commit3699b61f08848f071de9b52386cd82bb9dd822d6 (patch)
tree80b0d1e267c8e05a77453eb869e0e2f250981e40 /xs_set.h
parentf215c1a35bef25d85b2bea77331153f6a0632d20 (diff)
Backport from xs.
Diffstat (limited to 'xs_set.h')
-rw-r--r--xs_set.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/xs_set.h b/xs_set.h
index bd1b8ea..5e26abb 100644
--- a/xs_set.h
+++ b/xs_set.h
@@ -32,11 +32,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));
}