/soc/2015/jgeboski/facebook: 20aa4aca7096: facebook: added g_sli...

James Geboski jgeboski at gmail.com
Tue Jun 23 19:55:44 EDT 2015


Changeset: 20aa4aca70965b162ef21640d9699da7a73adb91
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-06-23 19:55 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/20aa4aca7096

Description:

facebook: added g_slist_copy_deep() compatibility function

diffstat:

 libpurple/protocols/facebook/glibcompat.h |  22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diffs (37 lines):

diff --git a/libpurple/protocols/facebook/glibcompat.h b/libpurple/protocols/facebook/glibcompat.h
--- a/libpurple/protocols/facebook/glibcompat.h
+++ b/libpurple/protocols/facebook/glibcompat.h
@@ -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 @@ g_byte_array_new_take(guint8 *data, gsiz
 
 #endif /* < 2.32.0 */
 
+#endif /* < 2.34.0 */
+
 #endif /* _FACEBOOK_GLIBCOMPAT_H_ */



More information about the Commits mailing list