Commit graph

6 commits

Author SHA1 Message Date
David Lamparter 01734da376 lib: add dedicated pop() to DECLARE_SKIPLIST
The skiplist code was previously falling back to the del() code path for
a pop() on a skiplist.  This is unneeded complexity, a pop() can be done
more efficiently.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-21 05:18:16 +02:00
Donald Sharp 98d28ef55d lib: Make _find functions treat the head as const
The head of a list should not change for find functions.  Probably
are others that should be considered but these changes can come
in as needed I believe.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-02 16:21:38 -04:00
Lou Berger e8b9ad5cdd
Revert "Zebra diet" 2019-05-02 06:54:59 -04:00
Donald Sharp a07f484614 lib: Make _find functions treat the head as const
The head of a list should not change for find functions.  Probably
are others that should be considered but these changes can come
in as needed I believe.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-01 20:28:57 -04:00
David Lamparter 80911bc26a lib: typesafe rb-tree
Typesafe red-black tree, built out of the OpenBSD implementation and the
macro soup layered on top.  API compatible with skiplists & simple
lists.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-27 18:22:38 +02:00
David Lamparter abd71baa2e lib: typesafe lists, skiplist & hash
By the power of the C preprocessor, these macros provide type-safe
warppers for simple lists, skiplists and hash tables.  Also, by changing
the instantiation macro, it is easily possible to switch between
algorithms;  the code itself does not need to be changed since the API
is identical across all algorithms.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-27 18:20:35 +02:00