X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Futils_llist.c;h=a81503578bc28b8e56da29d17dc72937788a6aa2;hb=4c66592ee43abb01bfc792dac9bcc0df9d3df567;hp=2e04152f9ec9db12dac5d55ae03af644998666ed;hpb=fe37091ff0fd9e69d64a0ba72e5c21ddaf7d902f;p=collectd.git diff --git a/src/utils_llist.c b/src/utils_llist.c index 2e04152f..a8150357 100644 --- a/src/utils_llist.c +++ b/src/utils_llist.c @@ -110,6 +110,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;