Bug fixes

This commit is contained in:
Justin Ethier 2021-01-07 10:10:25 -08:00
parent 220934f3d3
commit d2b500278c
2 changed files with 5 additions and 5 deletions

View file

@ -144,12 +144,12 @@ int hashset_is_member(hashset_t set, void *item)
return 0; return 0;
} }
void hashset_to_array(hashset_t set, void *items) void hashset_to_array(hashset_t set, void **items)
{ {
for (unsigned int hs = 0, a = 0; hs ; set->capacity; hs++) { for (unsigned int hs = 0, a = 0; hs < set->capacity; hs++) {
size_t value = (size_t)item; size_t value = (size_t)set->items[hs];
if (value != 0 && value != 1) { if (value != 0 && value != 1) {
items[a] = set->items[hs]; items[a] = (void *)value;
a++; a++;
} }
} }

View file

@ -66,7 +66,7 @@ extern "C" {
*/ */
int hashset_is_member(hashset_t set, void *item); int hashset_is_member(hashset_t set, void *item);
void hashset_to_array(hashset_t set, void *items); void hashset_to_array(hashset_t set, void **items);
#ifdef __cplusplus #ifdef __cplusplus
} }