diff options
| author | EuAndreh <eu@euandre.org> | 2025-01-12 00:14:03 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2025-01-12 14:27:57 -0300 |
| commit | 44d56f5311f98a8955c67638e7520963dbd4d845 (patch) | |
| tree | fbb2c58c79f1730ff62c83cef116fb5c0e035dfe /src/set.c | |
| parent | Replace src/config.h with <s.h>; incorporate changes from other projects (diff) | |
| download | pindaiba-44d56f5311f98a8955c67638e7520963dbd4d845.tar.gz pindaiba-44d56f5311f98a8955c67638e7520963dbd4d845.tar.xz | |
Revamp lib, simplify it a bit and address some FIXMEs
Diffstat (limited to '')
| -rw-r--r-- | src/set.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,4 +1,4 @@ -#include "config.h" +#include <s.h> #include <assert.h> #include <errno.h> @@ -8,13 +8,11 @@ #include <stdint.h> #include <string.h> -#include <endiannessbs.h> -#include <siphashbs.h> +#include <endianness.h> #include "hash.h" #include "logerr.h" #include "tree.h" -#include "util.h" #include "vector.h" #include "set.h" @@ -73,7 +71,8 @@ out: vector_free(&table); } if (ret != NULL) { - freeit((void *)&ret); + free((struct Set *)ret); + ret = NULL; } } return rc; @@ -84,7 +83,8 @@ set_free(const struct Set **const s) { assert((*s) != NULL); const struct Vector *table = (*s)->table; vector_free(&table); - freeit((void *)s); + free((struct Set *)*s); + *s = NULL; } int @@ -94,7 +94,7 @@ set_add(const struct Set *const s, const void *const value) { uint8_t hash_bytes[HASH_OUTPUT_LENGTH]; hash(s->value_size, value, hash_bytes); - const uint64_t hash_value = endiannessbs_from_le64(hash_bytes); + const uint64_t hash_value = endianness_from_le64(hash_bytes); const size_t idx = hash_value % vector_capacity(s->table); const struct Tree *slot; |
