Commit aedb8717 authored by Gnome CVS User's avatar Gnome CVS User
Browse files

Moved list concatenation code from gtkmain.c into its proper

place in glib/glist.c, added corresponding g_slist_concat.
parent 33b94315
......@@ -367,6 +367,8 @@ GList* g_list_prepend (GList *list,
GList* g_list_insert (GList *list,
gpointer data,
gint position);
GList* g_list_concat (GList *list1,
GList *list2);
GList* g_list_remove (GList *list,
gpointer data);
GList* g_list_remove_link (GList *list,
......@@ -396,6 +398,8 @@ GSList* g_slist_prepend (GSList *list,
GSList* g_slist_insert (GSList *list,
gpointer data,
gint position);
GSList* g_slist_concat (GSList *list1,
GSList *list2);
GSList* g_slist_remove (GSList *list,
gpointer data);
GSList* g_slist_remove_link (GSList *list,
......
......@@ -202,6 +202,24 @@ g_list_insert (GList *list,
return list;
}
GList *
g_list_concat (GList *list1, GList *list2)
{
GList *tmp_list;
if (list2)
{
tmp_list = g_list_last (list1);
if (tmp_list)
tmp_list->next = list2;
else
list1 = list2;
list2->prev = tmp_list;
}
return list1;
}
GList*
g_list_remove (GList *list,
gpointer data)
......
......@@ -174,6 +174,20 @@ g_slist_insert (GSList *list,
return list;
}
GSList *
g_slist_concat (GSList *list1, GSList *list2)
{
if (list2)
{
if (list1)
g_slist_last (list1)->next = list2;
else
list1 = list2;
}
return list1;
}
GSList*
g_slist_remove (GSList *list,
gpointer data)
......
......@@ -784,26 +784,6 @@ gtk_handle_current_timeouts (guint32 the_time)
}
}
/* Utility function - make up for an ommision in glib */
static GList *
gtk_main_list_concat (GList *list1, GList *list2)
{
GList *tmp_list;
GList *list;
if (list2)
{
tmp_list = g_list_last (list1);
if (tmp_list)
tmp_list->next = list2;
else
list1 = list2;
list2->prev = tmp_list;
}
return list1;
}
static void
gtk_handle_timeouts ()
{
......@@ -832,7 +812,7 @@ gtk_handle_timeouts ()
tmp_list = tmp_list->next;
timeout_functions = g_list_remove_link (timeout_functions, tmp_list2);
current_timeouts = gtk_main_list_concat (current_timeouts, tmp_list2);
current_timeouts = g_list_concat (current_timeouts, tmp_list2);
}
else
{
......@@ -886,7 +866,7 @@ gtk_handle_current_idles ()
}
else
{
idle_functions = gtk_main_list_concat (idle_functions, tmp_list);
idle_functions = g_list_concat (idle_functions, tmp_list);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment