[xbuild] Throw ArgumentNullException if target name is null
[mono.git] / eglib / src / glist.c
index 535008e1fe9a078d1a505cfd80b7f0be506f82b5..0e5eb3ac4d20d54e5e1304e586ebb2acc6ed4fa7 100644 (file)
@@ -160,6 +160,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 +221,8 @@ g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
 {
        GList *prev = NULL;
        GList *current;
-       
+       GList *node;
+
        if (!func)
                return list;
 
@@ -216,7 +233,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;
 }