Add fast key-value lookup to a C program by including one header file and using HASH_ADD and HASH_FIND macros.
Store and retrieve structs by a string key in a systems program without pulling in a larger external dependency.
Use uthash in an embedded C project where linking against external libraries is not practical.
Include one header file, no changes to your build system required.
uthash is a C library that provides hash tables through macros, which are a form of code shorthand built into the C language. A hash table is a data structure that lets a program store and look up items by a key, such as finding a user record by username in roughly constant time no matter how many records exist. This kind of lookup speed is useful in systems software, embedded devices, and any program written in C that needs to manage large collections of named data. The library delivers this through macros rather than functions. That means you include a single header file in your project and then use the provided macros directly in your code. There is no separate compilation step and no additional library to link against. The header file is the entire library. The repository description mentions hash tables and more, suggesting additional data structures are included, but the README itself is minimal. It points to external documentation at the project website for details on usage and supported structures. The project has been around long enough to accumulate a substantial number of stars, and it includes continuous integration checks on multiple platforms, which suggests it is actively maintained and tested. For anyone working in C who needs a hash table without pulling in a larger dependency, this appears to be a focused and self-contained option. Because the README in the repository is essentially a pointer to external documentation, full usage details and the complete list of supported data structures are not available here.
← troydhanson on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.