diff options
| author | 2023-01-28 17:49:02 +0100 | |
|---|---|---|
| committer | 2023-01-28 17:49:02 +0100 | |
| commit | 876bebd9ac904ca930117237edaf8c3dcae7a922 (patch) | |
| tree | 7e91e26c49e18fd80c7de93ff275ffce83fb14df /xs_set.h | |
| parent | Bumped version. (diff) | |
| download | penes-snac2-876bebd9ac904ca930117237edaf8c3dcae7a922.tar.gz penes-snac2-876bebd9ac904ca930117237edaf8c3dcae7a922.tar.xz penes-snac2-876bebd9ac904ca930117237edaf8c3dcae7a922.zip | |
Backport from xs.
Diffstat (limited to 'xs_set.h')
| -rw-r--r-- | xs_set.h | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -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 | ||
| 14 | void xs_set_init(xs_set *s); | 14 | void xs_set_init(xs_set *s); |
| 15 | d_char *xs_set_result(xs_set *s); | 15 | xs_list *xs_set_result(xs_set *s); |
| 16 | void xs_set_free(xs_set *s); | 16 | void xs_set_free(xs_set *s); |
| 17 | int xs_set_add(xs_set *s, const char *data); | 17 | int 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 | ||
| 36 | d_char *xs_set_result(xs_set *s) | 36 | xs_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 | ||
| 96 | int xs_set_add(xs_set *s, const char *data) | 96 | int 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 | { |