uHash is now part of the uLib library. All further development has moved there.
Implementation of a type-safe, generic hash table data structure written in C. It's a fork of klib's khash, aimed at extending its API and providing additional configuration options.
- Hash table primitives (
uhash_get
,uhash_put
,uhash_delete
,uhash_contains
, ...) - Iteration macros (
uhash_foreach
,uhash_foreach_key
,uhash_foreach_value
) - Map-specific high-level API (
uhmap_get
,uhmap_set
,uhmap_remove
, ...) - Set-specific high-level API (
uhset_insert
,uhset_remove
,uhset_is_superset
, ...)
If you are using CMake as your build system, you can add uHash
as
a subproject, then link against the uhash
target. Otherwise, in general you just need
the uhash.h header.
Documentation for the project is provided in form of docstrings in the Public API section of uhash.h. You can also generate HTML docs via CMake, though you will also need Doxygen. For usage examples, see test.c.
uhash
: interface library target, which you can link against.uhash-docs
: generates documentation via Doxygen.uhash-test
: generates the test suite.uhash-bench
: generates benchmarks.
uHash
is available under the MIT license. See the LICENSE file for more info.