summaryrefslogtreecommitdiffstats
path: root/lib/generic/README.rst
blob: e6a9994155b34f8306b5878bd3561c4ec6e3810d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.. SPDX-License-Identifier: GPL-3.0-or-later

Generics library
----------------

This small collection of "generics" was born out of frustration that I couldn't find no
such thing for C. It's either bloated, has poor interface, null-checking is absent or
doesn't allow custom allocation scheme. BSD-licensed (or compatible) code is allowed here,
as long as it comes with a test case in `tests/test_generics.c`.

* array_ - a set of simple macros to make working with dynamic arrays easier.
* queue_ - a FIFO + LIFO queue.
* map_ - a `Crit-bit tree`_ key-value map implementation (public domain) that comes with tests.
* set_ - set abstraction implemented on top of ``map`` (unused now).
* pack_ - length-prefixed list of objects (i.e. array-list).
* lru_ - LRU-like hash table
* trie_ - a trie-based key-value map, taken from knot-dns

array
~~~~~

.. doxygenfile:: array.h
   :project: libkres

queue
~~~~~

.. doxygenfile:: queue.h
   :project: libkres

map
~~~

.. doxygenfile:: map.h
   :project: libkres

set
~~~

.. doxygenfile:: set.h
   :project: libkres

pack
~~~~

.. doxygenfile:: pack.h
   :project: libkres

lru
~~~

.. doxygenfile:: lru.h
   :project: libkres

trie
~~~~

.. doxygenfile:: trie.h
   :project: libkres


.. _`Crit-bit tree`: https://cr.yp.to/critbit.html