lib: linklist: add listnode_add_before()

This utility function, to join the zoo that the Quagga linked-list
implementation has accumulated, does an insert-before while returning
the newly allocated node.

It is similar to:
- listnode_add_after(), but
  - complementary direction
  - returns allocated node
- list_add_node_prev(), but
  - supports before == NULL
  - returns allocated node

In general, the entire linked-list implementation is in bad shape, and
while it needs a cleanup / rewrite / replacement, this would both cause
significant conflicts and block other cleanups...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 files changed