Moved list concatenation code from gtkmain.c into its proper

place in glib/glist.c, added corresponding g_slist_concat.
This commit is contained in:
Gnome CVS User 1997-11-26 01:52:50 +00:00
parent 33b9431580
commit aedb8717f1
4 changed files with 38 additions and 22 deletions

View File

@ -367,6 +367,8 @@ GList* g_list_prepend (GList *list,
GList* g_list_insert (GList *list, GList* g_list_insert (GList *list,
gpointer data, gpointer data,
gint position); gint position);
GList* g_list_concat (GList *list1,
GList *list2);
GList* g_list_remove (GList *list, GList* g_list_remove (GList *list,
gpointer data); gpointer data);
GList* g_list_remove_link (GList *list, GList* g_list_remove_link (GList *list,
@ -396,6 +398,8 @@ GSList* g_slist_prepend (GSList *list,
GSList* g_slist_insert (GSList *list, GSList* g_slist_insert (GSList *list,
gpointer data, gpointer data,
gint position); gint position);
GSList* g_slist_concat (GSList *list1,
GSList *list2);
GSList* g_slist_remove (GSList *list, GSList* g_slist_remove (GSList *list,
gpointer data); gpointer data);
GSList* g_slist_remove_link (GSList *list, GSList* g_slist_remove_link (GSList *list,

View File

@ -202,6 +202,24 @@ g_list_insert (GList *list,
return 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* GList*
g_list_remove (GList *list, g_list_remove (GList *list,
gpointer data) gpointer data)

View File

@ -174,6 +174,20 @@ g_slist_insert (GSList *list,
return 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* GSList*
g_slist_remove (GSList *list, g_slist_remove (GSList *list,
gpointer data) gpointer data)

View File

@ -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 static void
gtk_handle_timeouts () gtk_handle_timeouts ()
{ {
@ -832,7 +812,7 @@ gtk_handle_timeouts ()
tmp_list = tmp_list->next; tmp_list = tmp_list->next;
timeout_functions = g_list_remove_link (timeout_functions, tmp_list2); 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 else
{ {
@ -886,7 +866,7 @@ gtk_handle_current_idles ()
} }
else else
{ {
idle_functions = gtk_main_list_concat (idle_functions, tmp_list); idle_functions = g_list_concat (idle_functions, tmp_list);
} }
} }
} }