csnip
0.1
|
Macros to manipulate linked lists. More...
Modules | |
Doubly Linked Lists | |
Macros for doubly linked lists. | |
Singly Linked Lists with tail pointers | |
These macros implement intrusive linked lists. Two variants are provided: slist for singly linked lists, and dlist for doubly linked lists.
Linked lists can be used as stacks and deques for example, but they usually not the most efficient implementation of those data structures, due to their poor locality. However, they have some nice properties that make them very useful: Pointers to list elements are not invalidated through manipulation of lists, and it's easy to move list elements between lists. They are often the most elegant solution when data records need to be managed in multiple disjoint lists, e.g. the differnt lists holding records in states.
Lists are fairly simple data structures, and this implementation tries to preserve the spirit of simplicity: it provides only the basic list operations themselves, without e.g. element allocation and deallocation. Most list operations therefore cannot fail (though misuse can corrupt the data structures). csnip_err is therefore not used in this module.