summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
authorGravatar default2023-01-28 17:49:02 +0100
committerGravatar default2023-01-28 17:49:02 +0100
commit876bebd9ac904ca930117237edaf8c3dcae7a922 (patch)
tree7e91e26c49e18fd80c7de93ff275ffce83fb14df /xs_set.h
parentBumped version. (diff)
downloadsnac2-876bebd9ac904ca930117237edaf8c3dcae7a922.tar.gz
snac2-876bebd9ac904ca930117237edaf8c3dcae7a922.tar.xz
snac2-876bebd9ac904ca930117237edaf8c3dcae7a922.zip
Backport from xs.
Diffstat (limited to 'xs_set.h')
-rw-r--r--xs_set.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/xs_set.h b/xs_set.h
index d1daa01..8829f14 100644
--- a/xs_set.h
+++ b/xs_set.h
@@ -8,13 +8,13 @@ typedef struct _xs_set {
8 int elems; /* number of hash entries */ 8 int elems; /* number of hash entries */
9 int used; /* number of used hash entries */ 9 int used; /* number of used hash entries */
10 int *hash; /* hashed offsets */ 10 int *hash; /* hashed offsets */
11 d_char *list; /* list of stored data */ 11 xs_list *list; /* list of stored data */
12} xs_set; 12} xs_set;
13 13
14void xs_set_init(xs_set *s); 14void xs_set_init(xs_set *s);
15d_char *xs_set_result(xs_set *s); 15xs_list *xs_set_result(xs_set *s);
16void xs_set_free(xs_set *s); 16void xs_set_free(xs_set *s);
17int xs_set_add(xs_set *s, const char *data); 17int xs_set_add(xs_set *s, const xs_val *data);
18 18
19 19
20#ifdef XS_IMPLEMENTATION 20#ifdef XS_IMPLEMENTATION
@@ -33,10 +33,10 @@ void xs_set_init(xs_set *s)
33} 33}
34 34
35 35
36d_char *xs_set_result(xs_set *s) 36xs_list *xs_set_result(xs_set *s)
37/* returns the set as a list and frees it */ 37/* returns the set as a list and frees it */
38{ 38{
39 d_char *list = s->list; 39 xs_list *list = s->list;
40 s->list = NULL; 40 s->list = NULL;
41 s->hash = xs_free(s->hash); 41 s->hash = xs_free(s->hash);
42 42
@@ -93,7 +93,7 @@ static int _store_hash(xs_set *s, const char *data, int value)
93} 93}
94 94
95 95
96int xs_set_add(xs_set *s, const char *data) 96int xs_set_add(xs_set *s, const xs_val *data)
97/* adds the data to the set */ 97/* adds the data to the set */
98/* returns: 1 if added, 0 if already there */ 98/* returns: 1 if added, 0 if already there */
99{ 99{