/soc/2015/mmcc/main: 99eecd58690c: removing GLIB_CHECK_VERSION p...

Michael McConville mmcconville at mykolab.com
Tue Jun 23 16:02:33 EDT 2015


Changeset: 99eecd58690c9e62220da5ffd43c4f9b451d7763
Author:	 Michael McConville <mmcconville at mykolab.com>
Date:	 2015-06-18 17:12 -0400
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/99eecd58690c

Description:

removing GLIB_CHECK_VERSION preproc conditions

diffstat:

 finch/finch.c                     |   8 ---
 finch/libgnt/gntmain.c            |   5 --
 libpurple/certificate.c           |  27 +---------
 libpurple/core.c                  |   5 --
 libpurple/glibcompat.h            |  95 ---------------------------------------
 libpurple/media/backend-fs2.c     |   2 -
 libpurple/media/candidate.c       |   2 -
 libpurple/media/codec.c           |   2 -
 libpurple/mediamanager.c          |   2 -
 libpurple/network.c               |  49 +-------------------
 libpurple/plugins/caesarcipher.c  |   4 -
 libpurple/purple-client.c         |   5 --
 libpurple/tests/check_libpurple.c |   5 --
 libpurple/util.c                  |  12 ----
 libpurple/win32/win32dep.c        |   9 ---
 pidgin/gtkdebug.c                 |   4 -
 pidgin/pidgin.c                   |   8 ---
 17 files changed, 5 insertions(+), 239 deletions(-)

diffs (truncated from 570 to 300 lines):

diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -32,14 +32,6 @@ int main(int argc, char *argv[])
 	signal(SIGPIPE, SIG_IGN);
 #endif
 
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-	/* GLib threading system is automaticaly initialized since 2.32.
-	 * For earlier versions, it have to be initialized before calling any
-	 * Glib or GTK+ functions.
-	 */
-	g_thread_init(NULL);
-#endif
-
 	g_set_prgname("Finch");
 	g_set_application_name(_("Finch"));
 
diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c
--- a/finch/libgnt/gntmain.c
+++ b/finch/libgnt/gntmain.c
@@ -663,11 +663,6 @@ void gnt_init()
 #endif
 	signal(SIGINT, sighandler);
 
-#if !GLIB_CHECK_VERSION(2, 36, 0)
-	/* GLib type system is automaticaly initialized since 2.36. */
-	g_type_init();
-#endif
-
 	init_wm();
 
 	clipboard = g_object_new(GNT_TYPE_CLIPBOARD, NULL);
diff --git a/libpurple/certificate.c b/libpurple/certificate.c
--- a/libpurple/certificate.c
+++ b/libpurple/certificate.c
@@ -274,25 +274,19 @@ purple_certificate_check_signature_chain
 						"...Failed to get validity times for certificate %s\n"
 						"Chain is INVALID\n", uid);
 			else if (now > expiration) {
-#if GLIB_CHECK_VERSION(2,26,0)
 				GDateTime *exp_dt = g_date_time_new_from_unix_local(expiration);
 				gchar *expir_str = g_date_time_format(exp_dt, "%c");
 				g_date_time_unref(exp_dt);
-#else
-				gchar *expir_str = g_strdup(ctime(&expiration));
-#endif
+
 				purple_debug_error("certificate",
 						"...Issuer %s expired at %s\nChain is INVALID\n",
 						uid, expir_str);
 				g_free(expir_str);
 			} else {
-#if GLIB_CHECK_VERSION(2,26,0)
 				GDateTime *act_dt = g_date_time_new_from_unix_local(activation);
 				gchar *activ_str = g_date_time_format(act_dt, "%c");
 				g_date_time_unref(act_dt);
-#else
-				gchar *activ_str = g_strdup(ctime(&activation));
-#endif
+
 				purple_debug_error("certificate",
 						"...Not-yet-activated issuer %s will be valid at %s\n"
 						"Chain is INVALID\n", uid, activ_str);
@@ -498,9 +492,7 @@ purple_certificate_get_display_string(Pu
 	gchar *activ_str, *expir_str;
 	gboolean self_signed;
 	gchar *text;
-#if GLIB_CHECK_VERSION(2,26,0)
 	GDateTime *act_dt, *exp_dt;
-#endif
 
 	g_return_val_if_fail(crt, NULL);
 
@@ -524,7 +516,6 @@ purple_certificate_get_display_string(Pu
 		activation = expiration = 0;
 	}
 
-#if GLIB_CHECK_VERSION(2,26,0)
 	act_dt = g_date_time_new_from_unix_local(activation);
 	activ_str = g_date_time_format(act_dt, "%c");
 	g_date_time_unref(act_dt);
@@ -532,10 +523,6 @@ purple_certificate_get_display_string(Pu
 	exp_dt = g_date_time_new_from_unix_local(expiration);
 	expir_str = g_date_time_format(exp_dt, "%c");
 	g_date_time_unref(exp_dt);
-#else
-	activ_str = g_strdup(ctime(&activation));
-	expir_str = g_strdup(ctime(&expiration));
-#endif
 
 	self_signed = purple_certificate_signed_by(crt, crt);
 
@@ -1832,27 +1819,21 @@ x509_tls_cached_start_verify(PurpleCerti
 				"Failed to get validity times for certificate %s\n",
 				vrq->subject_name);
 	} else if (now > expiration) {
-#if GLIB_CHECK_VERSION(2,26,0)
 		GDateTime *exp_dt = g_date_time_new_from_unix_local(expiration);
 		gchar *expir_str = g_date_time_format(exp_dt, "%c");
 		g_date_time_unref(exp_dt);
-#else
-		gchar *expir_str = g_strdup(ctime(&expiration));
-#endif
 		flags |= PURPLE_CERTIFICATE_EXPIRED;
+
 		purple_debug_error("certificate/x509/tls_cached",
 				"Certificate %s expired at %s\n",
 				vrq->subject_name, expir_str);
 		g_free(expir_str);
 	} else if (now < activation) {
-#if GLIB_CHECK_VERSION(2,26,0)
 		GDateTime *act_dt = g_date_time_new_from_unix_local(activation);
 		gchar *activ_str = g_date_time_format(act_dt, "%c");
 		g_date_time_unref(act_dt);
-#else
-		gchar *activ_str = g_strdup(ctime(&activation));
-#endif
 		flags |= PURPLE_CERTIFICATE_NOT_ACTIVATED;
+
 		purple_debug_error("certificate/x509/tls_cached",
 				"Certificate %s is not yet valid, will be at %s\n",
 				vrq->subject_name, activ_str);
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -115,11 +115,6 @@ purple_core_init(const char *ui)
 	wpurple_init();
 #endif
 
-#if !GLIB_CHECK_VERSION(2, 36, 0)
-	/* GLib type system is automaticaly initialized since 2.36. */
-	g_type_init();
-#endif
-
 	_core = core = g_new0(PurpleCore, 1);
 	core->ui = g_strdup(ui);
 	core->reserved = NULL;
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -33,14 +33,6 @@
 
 #include <glib.h>
 
-#if !GLIB_CHECK_VERSION(2, 36, 0)
-
-#include <errno.h>
-#include <fcntl.h>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
 static inline gboolean g_close(gint fd, GError **error)
 {
 	int res;
@@ -61,93 +53,6 @@ static inline gboolean g_close(gint fd, 
 	return FALSE;
 }
 
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-
-#include <glib-object.h>
-#include <string.h>
-
-#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#define G_GNUC_END_IGNORE_DEPRECATIONS
-
-#define G_SOURCE_REMOVE FALSE
-#define G_SOURCE_CONTINUE TRUE
-
-#define g_signal_handlers_disconnect_by_data(instance, data) \
-	g_signal_handlers_disconnect_matched((instance), G_SIGNAL_MATCH_DATA, \
-			0, 0, NULL, NULL, (data))
-
-static inline GThread * g_thread_try_new(const gchar *name, GThreadFunc func,
-	gpointer data, GError **error)
-{
-	return g_thread_create(func, data, TRUE, error);
-}
-
-#if !GLIB_CHECK_VERSION(2, 30, 0)
-
-static inline gchar *g_utf8_substring(const gchar *str, glong start_pos,
-	glong end_pos)
-{
-	gchar *start = g_utf8_offset_to_pointer(str, start_pos);
-	gchar *end = g_utf8_offset_to_pointer(start, end_pos - start_pos);
-	gchar *out = g_malloc(end - start + 1);
-
-	memcpy(out, start, end - start);
-	out[end - start] = 0;
-
-	return out;
-}
-
-#if !GLIB_CHECK_VERSION(2, 28, 0)
-
-static inline gint64 g_get_monotonic_time(void)
-{
-	GTimeVal time_s;
-
-	g_get_current_time(&time_s);
-
-	return ((gint64)time_s.tv_sec << 32) | time_s.tv_usec;
-}
-
-static inline void g_list_free_full(GList *list, GDestroyNotify free_func)
-{
-	g_list_foreach(list, (GFunc)free_func, NULL);
-	g_list_free(list);
-}
-
-static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func)
-{
-	g_slist_foreach(list, (GFunc)free_func, NULL);
-	g_slist_free(list);
-}
-
-#if !GLIB_CHECK_VERSION(2, 26, 0)
-
-typedef struct stat GStatBuf;
-
-static inline void g_object_notify_by_pspec(GObject *object, GParamSpec *pspec)
-{
-	g_object_notify(object, g_param_spec_get_name(pspec));
-}
-
-static inline void g_object_class_install_properties(GObjectClass *oclass,
-	guint n_pspecs, GParamSpec **pspecs)
-{
-	guint i;
-	for (i = 1; i < n_pspecs; ++i)
-		g_object_class_install_property(oclass, i, pspecs[i]);
-}
-
-#endif /* < 2.26.0 */
-
-#endif /* < 2.28.0 */
-
-#endif /* < 2.30.0 */
-
-#endif /* < 2.32.0 */
-
-#endif /* < 2.36.0 */
-
-
 /* glib's definition of g_stat+GStatBuf seems to be broken on mingw64-w32 (and
  * possibly other 32-bit windows), so instead of relying on it,
  * we'll define our own.
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -189,10 +189,8 @@ enum {
 static void
 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
 {
-#if GLIB_CHECK_VERSION(2, 37, 3)
 	/* silence a warning */
 	(void)purple_media_backend_fs2_get_instance_private;
-#endif
 }
 
 static FsCandidateType
diff --git a/libpurple/media/candidate.c b/libpurple/media/candidate.c
--- a/libpurple/media/candidate.c
+++ b/libpurple/media/candidate.c
@@ -93,10 +93,8 @@ purple_media_candidate_init(PurpleMediaC
 	priv->password = NULL;
 	priv->ttl = 0;
 
-#if GLIB_CHECK_VERSION(2, 37, 3)
 	/* silence a warning */
 	(void)purple_media_candidate_get_instance_private;
-#endif
 }
 
 static void
diff --git a/libpurple/media/codec.c b/libpurple/media/codec.c
--- a/libpurple/media/codec.c
+++ b/libpurple/media/codec.c
@@ -75,10 +75,8 @@ purple_media_codec_init(PurpleMediaCodec
 	priv->encoding_name = NULL;
 	priv->optional_params = NULL;
 
-#if GLIB_CHECK_VERSION(2, 37, 3)
 	/* silence a warning */
 	(void)purple_media_codec_get_instance_private;
-#endif
 }
 
 static void
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -1986,10 +1986,8 @@ purple_media_element_info_get_id(PurpleM
 #ifdef USE_VV
 	gchar *id;
 
-#if GLIB_CHECK_VERSION(2, 37, 3)



More information about the Commits mailing list