I previously recommended MemSL, but the website and company seem to have gone extinct. I would now suggest glib, it covers much of the same functionality and is widely supported and used throughout the Linux community.
I used MemSL when implementing an x86 kernel, and I found it to be general, reliable, and bug free.
From the description:
C Overview of the Memory Structures Library (MemSL)
The Memory Structures Library, MemSL for short, is a library of useful routines allowing the efficient use of complex data structures in C. The MemSL contains routines for managing:
- Multi-Dimensional Dynamically Allocated Arrays
- Single Linked Lists
- Double Linked Lists
- Circular Linked Lists
- Cut, Copy and Paste with Linked Lists
- Multiple Positional Pointers to Linked Lists
- Stacks
- Queues
- Dequeues
- Sets
- Bags
- Tables
- Dictionaries
- Hash Tables with Separate Chaining
- Hash Tables with User-Defined Paging
- Hash Tables with Dynamic Paging
- Binary Search Trees
- Threaded Binary Search Trees
- AVL Balanced Binary Search Trees
- AVL Balanced Threaded Binary Search Trees
- Priority Heaps
- Fully Dynamic Priority Search Queues