Tue, 23 Jun 2015 19:55:32 -0400
facebook: added g_slist_copy_deep() compatibility function
| libpurple/protocols/facebook/glibcompat.h | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/facebook/glibcompat.h Tue Jun 23 17:15:51 2015 -0400 +++ b/libpurple/protocols/facebook/glibcompat.h Tue Jun 23 19:55:32 2015 -0400 @@ -26,6 +26,26 @@ #include <glib-object.h> #include <libpurple/glibcompat.h> +#if !GLIB_CHECK_VERSION(2, 34, 0) + +static inline GSList * +g_slist_copy_deep(GSList *list, GCopyFunc func, gpointer data) +{ + GSList *ret = NULL; + GSList *l; + gpointer *ptr; + + if (G_UNLIKELY(func == NULL)) { + return g_slist_copy(list); + } + + for (l = list; l != NULL; l = l->next) { + g_slist_prepend(ret, func(l->data, data)); + } + + return g_slist_reverse(ret); +} + #if !GLIB_CHECK_VERSION(2, 32, 0) static inline GByteArray* @@ -48,4 +68,6 @@ #endif /* < 2.32.0 */ +#endif /* < 2.34.0 */ + #endif /* _FACEBOOK_GLIBCOMPAT_H_ */