single-header hash table implementation
- c99
- uses FNV-1a hash algorithm
- uses linked lists to solve collisions
- no dependencies other than libc
- v2.0 now uses uses error codes where it can (no more "result" struct, less rust-like, more c-like)
- v2.0 now does no memory allocations
- v2.0 implments key hashing for u64 integers
copy and paste mkhas.h into your project
in a single c source file, include the header like this:
#define mkhas_IMPL
#include "mkhas.h"this will load all implementations of the functions in the source file
you can now compile it and use the table
see examples in example.c and the test scripts
use make example to build the example
use make test to build and run all tests
- the
mkhas_freeandmkhas_deletefunctions might crash the program if used incorrectly - i have not implemented results in the
mkhas_removeandmkhas_clearfunctions since i'm assuming the existence of the key implies a successful insertion. creating keys outside ofmkhas_getisn't recommended
licensed under the GNU GPLv3.0 or any later version, at your option. see LICENSE file for license and copyright information