X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=eglib%2Fsrc%2Fglist.c;h=882fda48ec9b75772bd8f780d2f1fbef9266ab54;hb=3f859a36994733241cf89f26c78c77b3498ef94a;hp=535008e1fe9a078d1a505cfd80b7f0be506f82b5;hpb=89d0ba3968d36576553e0f483b0c69465f94e8ae;p=mono.git diff --git a/eglib/src/glist.c b/eglib/src/glist.c index 535008e1fe9..882fda48ec9 100644 --- a/eglib/src/glist.c +++ b/eglib/src/glist.c @@ -125,6 +125,25 @@ g_list_remove (GList *list, gconstpointer data) return list; } +GList* +g_list_remove_all (GList *list, gconstpointer data) +{ + GList *current = g_list_find (list, data); + + if (!current) + return list; + + while (current) { + if (current == list) + list = list->next; + g_list_free_1 (disconnect_node (current)); + + current = g_list_find (list, data); + } + + return list; +} + GList* g_list_remove_link (GList *list, GList *link) { @@ -160,6 +179,22 @@ g_list_find (GList *list, gconstpointer data) return NULL; } +GList* +g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func) +{ + if (!func) + return NULL; + + while (list) { + if (func (list->data, data) == 0) + return list; + + list = list->next; + } + + return NULL; +} + GList* g_list_reverse (GList *list) { @@ -205,7 +240,8 @@ g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func) { GList *prev = NULL; GList *current; - + GList *node; + if (!func) return list; @@ -216,7 +252,7 @@ g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func) prev = current; } - GList *node = new_node (prev, data, current); + node = new_node (prev, data, current); return list == current ? node : list; }