/soc/2015/jgeboski/facebook: 556eea7a45da: facebook: merged loca...

James Geboski jgeboski at gmail.com
Fri Jul 31 22:33:39 EDT 2015


Changeset: 556eea7a45dad7fdde54bc886b2ed372f668966f
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-07-31 22:31 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/556eea7a45da

Description:

facebook: merged local glibcompat.h into libpurple's

diffstat:

 libpurple/glibcompat.h                    |  33 ++++++++++++++
 libpurple/protocols/facebook/Makefile.am  |   1 -
 libpurple/protocols/facebook/api.c        |   1 +
 libpurple/protocols/facebook/api.h        |   3 +-
 libpurple/protocols/facebook/data.c       |   1 +
 libpurple/protocols/facebook/data.h       |   3 +-
 libpurple/protocols/facebook/facebook.c   |   1 +
 libpurple/protocols/facebook/facebook.h   |   3 +-
 libpurple/protocols/facebook/glibcompat.h |  73 -------------------------------
 libpurple/protocols/facebook/http.h       |   4 +-
 libpurple/protocols/facebook/json.h       |   3 +-
 libpurple/protocols/facebook/mqtt.h       |   3 +-
 libpurple/protocols/facebook/util.c       |   2 +
 libpurple/protocols/facebook/util.h       |   3 +-
 14 files changed, 50 insertions(+), 84 deletions(-)

diffs (300 lines):

diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -61,6 +61,24 @@ static inline gboolean g_close(gint fd, 
 	return FALSE;
 }
 
+#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)
+		ret = g_slist_prepend(ret, func(l->data, data));
+
+	return g_slist_reverse(ret);
+}
+
 #if !GLIB_CHECK_VERSION(2, 32, 0)
 
 #include <glib-object.h>
@@ -76,6 +94,17 @@ static inline gboolean g_close(gint fd, 
 	g_signal_handlers_disconnect_matched((instance), G_SIGNAL_MATCH_DATA, \
 			0, 0, NULL, NULL, (data))
 
+static inline GByteArray * g_byte_array_new_take(guint8 *data, gsize len)
+{
+	GByteArray *array;
+
+	array = g_byte_array_new();
+	g_byte_array_append(array, data, len);
+	g_free(data);
+
+	return array;
+}
+
 static inline GThread * g_thread_try_new(const gchar *name, GThreadFunc func,
 	gpointer data, GError **error)
 {
@@ -84,6 +113,8 @@ static inline GThread * g_thread_try_new
 
 #if !GLIB_CHECK_VERSION(2, 30, 0)
 
+#define G_VALUE_INIT {0, {{0}}}
+
 static inline gchar *g_utf8_substring(const gchar *str, glong start_pos,
 	glong end_pos)
 {
@@ -145,6 +176,8 @@ static inline void g_object_class_instal
 
 #endif /* < 2.32.0 */
 
+#endif /* < 2.34.0 */
+
 #endif /* < 2.36.0 */
 
 
diff --git a/libpurple/protocols/facebook/Makefile.am b/libpurple/protocols/facebook/Makefile.am
--- a/libpurple/protocols/facebook/Makefile.am
+++ b/libpurple/protocols/facebook/Makefile.am
@@ -13,7 +13,6 @@ FACEBOOKSOURCES = \
 	data.h \
 	facebook.h \
 	facebook.c \
-	glibcompat.h \
 	http.c \
 	http.h \
 	id.h \
diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "api.h"
+#include "glibcompat.h"
 #include "http.h"
 #include "json.h"
 #include "marshal.h"
diff --git a/libpurple/protocols/facebook/api.h b/libpurple/protocols/facebook/api.h
--- a/libpurple/protocols/facebook/api.h
+++ b/libpurple/protocols/facebook/api.h
@@ -22,9 +22,10 @@
 #ifndef _FACEBOOK_API_H_
 #define _FACEBOOK_API_H_
 
+#include <glib.h>
+
 #include "internal.h"
 
-#include "glibcompat.h"
 #include "http.h"
 #include "id.h"
 #include "mqtt.h"
diff --git a/libpurple/protocols/facebook/data.c b/libpurple/protocols/facebook/data.c
--- a/libpurple/protocols/facebook/data.c
+++ b/libpurple/protocols/facebook/data.c
@@ -23,6 +23,7 @@
 
 #include "api.h"
 #include "data.h"
+#include "glibcompat.h"
 
 struct _FbDataPrivate
 {
diff --git a/libpurple/protocols/facebook/data.h b/libpurple/protocols/facebook/data.h
--- a/libpurple/protocols/facebook/data.h
+++ b/libpurple/protocols/facebook/data.h
@@ -22,8 +22,9 @@
 #ifndef _FACEBOOK_DATA_H_
 #define _FACEBOOK_DATA_H_
 
+#include <glib.h>
+
 #include "connection.h"
-#include "glibcompat.h"
 
 #define FB_DATA_ICON_MAX 4
 
diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -23,6 +23,7 @@
 
 #include "account.h"
 #include "connection.h"
+#include "glibcompat.h"
 #include "plugins.h"
 #include "protocol.h"
 #include "protocols.h"
diff --git a/libpurple/protocols/facebook/facebook.h b/libpurple/protocols/facebook/facebook.h
--- a/libpurple/protocols/facebook/facebook.h
+++ b/libpurple/protocols/facebook/facebook.h
@@ -22,7 +22,8 @@
 #ifndef _FACEBOOK_H_
 #define _FACEBOOK_H_
 
-#include "glibcompat.h"
+#include <glib.h>
+
 #include "protocol.h"
 
 #define FACEBOOK_TYPE_PROTOCOL             (facebook_protocol_get_type())
diff --git a/libpurple/protocols/facebook/glibcompat.h b/libpurple/protocols/facebook/glibcompat.h
deleted file mode 100644
--- a/libpurple/protocols/facebook/glibcompat.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
- */
-
-#ifndef _FACEBOOK_GLIBCOMPAT_H_
-#define _FACEBOOK_GLIBCOMPAT_H_
-
-#include <glib.h>
-#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) {
-		ret = g_slist_prepend(ret, func(l->data, data));
-	}
-
-	return g_slist_reverse(ret);
-}
-
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-
-static inline GByteArray*
-g_byte_array_new_take(guint8 *data, gsize len)
-{
-	GByteArray *array;
-
-	array = g_byte_array_new();
-	g_byte_array_append(array, data, len);
-	g_free(data);
-
-	return array;
-}
-
-#if !GLIB_CHECK_VERSION(2, 30, 0)
-
-#define G_VALUE_INIT  {0, {{0}}}
-
-#endif /* < 2.30.0 */
-
-#endif /* < 2.32.0 */
-
-#endif /* < 2.34.0 */
-
-#endif /* _FACEBOOK_GLIBCOMPAT_H_ */
diff --git a/libpurple/protocols/facebook/http.h b/libpurple/protocols/facebook/http.h
--- a/libpurple/protocols/facebook/http.h
+++ b/libpurple/protocols/facebook/http.h
@@ -22,10 +22,10 @@
 #ifndef _FACEBOOK_HTTP_H_
 #define _FACEBOOK_HTTP_H_
 
+#include <glib.h>
+
 #include <libpurple/http.h>
 
-#include "glibcompat.h"
-
 #define FB_HTTP_ERROR fb_http_error_quark()
 
 typedef GHashTable FbHttpParams;
diff --git a/libpurple/protocols/facebook/json.h b/libpurple/protocols/facebook/json.h
--- a/libpurple/protocols/facebook/json.h
+++ b/libpurple/protocols/facebook/json.h
@@ -22,10 +22,9 @@
 #ifndef _FACEBOOK_JSON_H_
 #define _FACEBOOK_JSON_H_
 
+#include <glib.h>
 #include <json-glib/json-glib.h>
 
-#include "glibcompat.h"
-
 #define FB_JSON_ERROR fb_json_error_quark()
 
 typedef enum _FbJsonError FbJsonError;
diff --git a/libpurple/protocols/facebook/mqtt.h b/libpurple/protocols/facebook/mqtt.h
--- a/libpurple/protocols/facebook/mqtt.h
+++ b/libpurple/protocols/facebook/mqtt.h
@@ -22,10 +22,9 @@
 #ifndef _FACEBOOK_MQTT_H_
 #define _FACEBOOK_MQTT_H_
 
+#include <glib.h>
 #include <string.h>
 
-#include "glibcompat.h"
-
 #define FB_MQTT_NAME "MQIsdp"
 #define FB_MQTT_VERS 3
 #define FB_MQTT_KA   60
diff --git a/libpurple/protocols/facebook/util.c b/libpurple/protocols/facebook/util.c
--- a/libpurple/protocols/facebook/util.c
+++ b/libpurple/protocols/facebook/util.c
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <zlib.h>
 
+#include "glibcompat.h"
+
 #include "util.h"
 
 GQuark
diff --git a/libpurple/protocols/facebook/util.h b/libpurple/protocols/facebook/util.h
--- a/libpurple/protocols/facebook/util.h
+++ b/libpurple/protocols/facebook/util.h
@@ -22,8 +22,9 @@
 #ifndef _FACEBOOK_UTIL_H_
 #define _FACEBOOK_UTIL_H_
 
+#include <glib.h>
+
 #include "connection.h"
-#include "glibcompat.h"
 
 #define FB_UTIL_DEBUG_INFO (        \
 		PURPLE_DEBUG_INFO |         \



More information about the Commits mailing list