GNOME Bugzilla – Bug 117994
g_list_from_g_slist and viceversa
Last modified: 2004-12-22 21:47:04 UTC
I was reading through the eel extensions to glib and I noticed these two functions that seem general and easy enaugh. Maybe they are worth to be included in glib. If you are interested I can prepare a patch (with the gtk coding style and with inline docs) GList * g_list_from_g_slist (GSList *slist) { GList *list; GSList *node; list = NULL; for (node = slist; node; node = node->next) { list = g_list_prepend (list, node->data); } return g_list_reverse (list); } GSList * g_slist_from_g_list (GList *list) { GSList *slist; GList *node; slist = NULL; for (node = list; node; node = node->next) { slist = g_slist_prepend (slist, node->data); } return g_slist_reverse (slist); }
*** This bug has been marked as a duplicate of 60198 ***