diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-05-25 14:53:21 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-05-25 14:53:21 +0000 |
commit | e80c7f2ae7d3946a5398cfa35dfe92027249024b (patch) | |
tree | ef588909b0ec388e3b8df34d372167c6526d86e3 /eglib/gmain.c | |
parent | 99fe5d4bd60337b53beb4da797ea77f2717ce014 (diff) |
Add missing list functions
Diffstat (limited to 'eglib/gmain.c')
-rw-r--r-- | eglib/gmain.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/eglib/gmain.c b/eglib/gmain.c index 89794c05..027fd60c 100644 --- a/eglib/gmain.c +++ b/eglib/gmain.c @@ -1164,6 +1164,40 @@ GSList* g_slist_last(GSList *list) return list; } +static inline GSList* _g_slist_remove_link(GSList *list, GSList *link) +{ + GSList *tmp; + GSList *prev; + + prev = NULL; + tmp = list; + + while (tmp) { + if (tmp == link) { + if (prev) + prev->next = tmp->next; + if (list == tmp) + list = list->next; + + tmp->next = NULL; + break; + } + + prev = tmp; + tmp = tmp->next; + } + + return list; +} + +GSList* g_slist_delete_link(GSList *list, GSList *link) +{ + list = _g_slist_remove_link(list, link); + g_free(link); + + return list; +} + /* Memory allocation functions */ gpointer g_malloc(gulong n_bytes) |