This is a tiny lib for c, implemented easily, which you can care nothing about type casting.
This lib includes some data structures as well as some easy but often used functions.
- dynamic array - array
- linked list - list
- pool - pool
- hash - hash
- tree map - tree_map
- hash map - hash_map
- bitmap - bitmap
- bloom filter - bloom_filter
- coroutine - coro
- string utils - strutil
- logger utils - logger
- debug utils - debug
The api of tlfc is all the same among these data structures:
make_xxx
: create/alloc and then initialize a data structure, e.g.make_array
, usually used asarray_int_t a = make_array()
, but some may not havemake
method, e.g.pool_t
xxx_init
: initialize a data structure, e.g.list_init
, usually used asarray_int_t a; array_init(&a)
xxx_get
: get data/nodes of a data structure, e.g.array_get
xxx_set
: set data/nodes of a data structure, e.g.array_set
xxx_insert
: insert data/nodes of a data structure, e.g.list_insert
xxx_remove
: remove data/nodes of a data structure, e.g.list_remove
xxx_deinit
: destroy a data structure, e.g.list_deinit
In almost all api, if your access is invalid, the program will crash.
You can check source code of coro, it uses pool and list.