X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_llist.c;h=d8694e3f6770fb5cba12d48af9a4c15d64a04e35;hb=12c1e32ec71ffd5d90af5df4b430fba04d91aed5;hp=2e04152f9ec9db12dac5d55ae03af644998666ed;hpb=f179018be96e1e1aea25d4928bdaf100a9a92a7d;p=collectd.git diff --git a/src/utils_llist.c b/src/utils_llist.c index 2e04152f..d8694e3f 100644 --- a/src/utils_llist.c +++ b/src/utils_llist.c @@ -21,6 +21,8 @@ * Florian Forster */ +#include "config.h" + #include #include @@ -110,6 +112,22 @@ void llist_prepend (llist_t *l, llentry_t *e) l->head = e; } +void llist_remove (llist_t *l, llentry_t *e) +{ + llentry_t *prev; + + prev = l->head; + while ((prev != NULL) && (prev->next != e)) + prev = prev->next; + + if (prev != NULL) + prev->next = e->next; + if (l->head == e) + l->head = e->next; + if (l->tail == e) + l->tail = prev; +} + llentry_t *llist_search (llist_t *l, const char *key) { llentry_t *e;