summaryrefslogtreecommitdiffstats
path: root/test/linked_list.c
Commit message (Collapse)AuthorAgeFilesLines
* test/linked_list: silence nonsense warningswm42019-09-211-6/+12
| | | | | | | | | | ../misc/linked_list.h:71:34: warning: the address of ‘e6’ will always evaluate as ‘true’ [-Waddress] No shit, e6 is on the stack. But the macro argument is also allowed to be NULL. Add some dumb nonsense to shut up the useless warning. (It's probably useful in other contexts though, so don't disable it completely.)
* misc: add linked list helperswm42018-05-241-0/+162
This provides macros for managing intrusive doubly linked lists. There are many ways how to do those in a "generic" way in C. For example Solaris style lists are pretty nice: https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/sys/list.h https://github.com/illumos/illumos-gate/blob/master/usr/src/common/list/list.c I even have an independent implementation of this, which could be ISC licensed. But I think it's easier to vomit ~100 lines of preprocessor garbage, which has a lower footprint, and I think it wins slightly on the side of type safety, simplicity, and ease of use, even if it doesn't look as magically nice.