summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a1b1d97)
raw | patch | inline | side by side (parent: a1b1d97)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 14 Jan 2007 13:36:17 +0000 (14:36 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 14 Jan 2007 13:36:17 +0000 (14:36 +0100) |
src/utils_llist.c | patch | blob | history | |
src/utils_llist.h | patch | blob | history |
diff --git a/src/utils_llist.c b/src/utils_llist.c
index 2e04152f9ec9db12dac5d55ae03af644998666ed..a81503578bc28b8e56da29d17dc72937788a6aa2 100644 (file)
--- a/src/utils_llist.c
+++ b/src/utils_llist.c
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;
diff --git a/src/utils_llist.h b/src/utils_llist.h
index e44d84ef1f9c4340c83416b6c858810c69c841a1..603fc87b552178e342a336539da6de7fa7fe1b9e 100644 (file)
--- a/src/utils_llist.h
+++ b/src/utils_llist.h
void llist_append (llist_t *l, llentry_t *e);
void llist_prepend (llist_t *l, llentry_t *e);
+void llist_remove (llist_t *l, llentry_t *e);
llentry_t *llist_search (llist_t *l, const char *key);