[gcr] Remove support code for old glib versions



commit f41b7511306faa1ae4134fb42d1933b7b29b14b4
Author: Stef Walter <stefw gnome org>
Date:   Tue Jun 26 15:56:08 2012 +0200

    Remove support code for old glib versions
    
     * Remove a bunch of #ifdefs for old glib versions prior
       to 2.32.0.
     * Already bumped glib dependency in a recent commit.

 egg/egg-libgcrypt.c     |    8 --------
 egg/egg-testing.h       |    2 --
 gck/gck-attributes.c    |   10 ----------
 gck/gck-enumerator.c    |    8 --------
 gck/gck-session.c       |    8 --------
 gcr/gcr-importer.c      |   10 ----------
 gcr/gcr-library.c       |    4 ----
 gcr/gcr-live-search.c   |   19 +------------------
 gcr/gcr-mock-prompter.c |   15 ---------------
 gcr/gcr-parser.c        |    4 ----
 gcr/gcr-system-prompt.c |    4 ----
 11 files changed, 1 insertions(+), 91 deletions(-)
---
diff --git a/egg/egg-libgcrypt.c b/egg/egg-libgcrypt.c
index b86447c..e2afc98 100644
--- a/egg/egg-libgcrypt.c
+++ b/egg/egg-libgcrypt.c
@@ -56,24 +56,16 @@ fatal_handler (gpointer unused, int unknown, const gchar *msg)
 static int
 glib_thread_mutex_init (void **lock)
 {
-#if GLIB_CHECK_VERSION(2,31,3)
 	*lock = g_new0 (GMutex, 1);
 	g_mutex_init (*lock);
-#else
-	*lock = g_mutex_new ();
-#endif
 	return 0;
 }
 
 static int
 glib_thread_mutex_destroy (void **lock)
 {
-#if GLIB_CHECK_VERSION(2,31,3)
 	g_mutex_clear (*lock);
 	g_free (*lock);
-#else
-	g_mutex_free (*lock);
-#endif
 	return 0;
 }
 
diff --git a/egg/egg-testing.h b/egg/egg-testing.h
index a058e09..a034b15 100644
--- a/egg/egg-testing.h
+++ b/egg/egg-testing.h
@@ -73,6 +73,4 @@ gboolean   egg_test_wait_until                 (int timeout);
 
 gint       egg_tests_run_with_loop             (void);
 
-gint       egg_tests_run_with_loop             (void);
-
 #endif /* EGG_DH_H_ */
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index d05287a..356d6f1 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -123,12 +123,7 @@ value_ref (guchar *data)
 
 	g_assert (data != NULL);
 
-#if GLIB_CHECK_VERSION (2,29,90)
 	previous = g_atomic_int_add (value, 1);
-#else
-	previous = g_atomic_int_exchange_and_add (value, 1);
-#endif
-
 	if (G_UNLIKELY (previous <= 0)) {
 		g_warning ("An owned GckAttribute value has been modified outside of the "
 		           "gck library or an invalid attribute was passed to gck_builder_add_attribute()");
@@ -240,12 +235,7 @@ gck_builder_ref (GckBuilder *builder)
 
 	g_return_val_if_fail (builder != NULL, NULL);
 
-#if GLIB_CHECK_VERSION (2,29,90)
 	stack = g_atomic_int_add (&real->refs, 1) == 0;
-#else
-	stack = g_atomic_int_exchange_and_add (&real->refs, 1) == 0;
-#endif
-
 	if G_UNLIKELY (stack) {
 		g_warning ("Never call gck_builder_ref() on a stack allocated GckBuilder structure");
 		return NULL;
diff --git a/gck/gck-enumerator.c b/gck/gck-enumerator.c
index 0c6cc02..2e11929 100644
--- a/gck/gck-enumerator.c
+++ b/gck/gck-enumerator.c
@@ -565,12 +565,8 @@ static void
 gck_enumerator_init (GckEnumerator *self)
 {
 	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_ENUMERATOR, GckEnumeratorPrivate);
-#if GLIB_CHECK_VERSION(2,31,2)
 	self->pv->mutex = g_new0 (GMutex, 1);
 	g_mutex_init (self->pv->mutex);
-#else
-	self->pv->mutex = g_mutex_new ();
-#endif
 	self->pv->the_state = g_new0 (GckEnumeratorState, 1);
 	self->pv->object_type = GCK_TYPE_OBJECT;
 	self->pv->object_class = g_type_class_ref (self->pv->object_type);
@@ -647,12 +643,8 @@ gck_enumerator_finalize (GObject *obj)
 	cleanup_state (self->pv->the_state);
 	g_free (self->pv->the_state);
 
-#if GLIB_CHECK_VERSION(2,31,2)
 	g_mutex_clear (self->pv->mutex);
 	g_free (self->pv->mutex);
-#else
-	g_mutex_free (self->pv->mutex);
-#endif
 	g_type_class_unref (self->pv->object_class);
 
 	G_OBJECT_CLASS (gck_enumerator_parent_class)->finalize (obj);
diff --git a/gck/gck-session.c b/gck/gck-session.c
index abf8226..b726b4a 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -141,12 +141,8 @@ static void
 gck_session_init (GckSession *self)
 {
 	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SESSION, GckSessionPrivate);
-#if GLIB_CHECK_VERSION(2,31,2)
 	self->pv->mutex = g_new0 (GMutex, 1);
 	g_mutex_init (self->pv->mutex);
-#else
-	self->pv->mutex = g_mutex_new ();
-#endif
 }
 
 static void
@@ -265,12 +261,8 @@ gck_session_finalize (GObject *obj)
 	g_clear_object (&self->pv->interaction);
 	g_clear_object (&self->pv->slot);
 
-#if GLIB_CHECK_VERSION(2,31,2)
 	g_mutex_clear (self->pv->mutex);
 	g_free (self->pv->mutex);
-#else
-	g_mutex_free (self->pv->mutex);
-#endif
 
 	G_OBJECT_CLASS (gck_session_parent_class)->finalize (obj);
 }
diff --git a/gcr/gcr-importer.c b/gcr/gcr-importer.c
index b20e452..cc03411 100644
--- a/gcr/gcr-importer.c
+++ b/gcr/gcr-importer.c
@@ -399,15 +399,10 @@ gcr_importer_import (GcrImporter *importer,
 	g_return_val_if_fail (iface->import_finish != NULL, FALSE);
 
 	closure = g_new0 (ImportClosure, 1);
-#if GLIB_CHECK_VERSION(2,31,2)
 	closure->cond = g_new (GCond, 1);
 	g_cond_init (closure->cond);
 	closure->mutex = g_new (GMutex, 1);
 	g_mutex_init (closure->mutex);
-#else
-	closure->cond = g_cond_new ();
-	closure->mutex = g_mutex_new ();
-#endif
 	closure->context = g_main_context_get_thread_default ();
 	g_mutex_lock (closure->mutex);
 
@@ -442,15 +437,10 @@ gcr_importer_import (GcrImporter *importer,
 	if (closure->error)
 		g_propagate_error (error, closure->error);
 
-#if GLIB_CHECK_VERSION(2,31,2)
 	g_cond_clear (closure->cond);
 	g_free (closure->cond);
 	g_mutex_clear (closure->mutex);
 	g_free (closure->mutex);
-#else
-	g_cond_free (closure->cond);
-	g_mutex_free (closure->mutex);
-#endif
 	g_free (closure);
 
 	return result;
diff --git a/gcr/gcr-library.c b/gcr/gcr-library.c
index 43d2ee6..12b0ff4 100644
--- a/gcr/gcr-library.c
+++ b/gcr/gcr-library.c
@@ -130,11 +130,7 @@ _gcr_initialize_library (void)
 {
 	static gint gcr_initialize = 0;
 
-#if GLIB_CHECK_VERSION (2,29,90)
 	if (g_atomic_int_add (&gcr_initialize, 1) == 0)
-#else
-	if (g_atomic_int_exchange_and_add (&gcr_initialize, 1) == 0)
-#endif
 		return;
 
 	/* Initialize the libgcrypt library if needed */
diff --git a/gcr/gcr-live-search.c b/gcr/gcr-live-search.c
index 38de732..919e7ff 100644
--- a/gcr/gcr-live-search.c
+++ b/gcr/gcr-live-search.c
@@ -64,11 +64,7 @@ stripped_char (gunichar ch)
 {
 	gunichar retval = 0;
 	GUnicodeType utype;
-#if GLIB_CHECK_VERSION (2,29,90)
 	gunichar decomp[4];
-#else
-	gunichar *decomp;
-#endif
 	gsize dlen;
 
 	utype = g_unichar_type (ch);
@@ -78,11 +74,7 @@ stripped_char (gunichar ch)
 	case G_UNICODE_FORMAT:
 	case G_UNICODE_UNASSIGNED:
 	case G_UNICODE_NON_SPACING_MARK:
-#if GLIB_CHECK_VERSION (2,29,90)
 	case G_UNICODE_SPACING_MARK:
-#else
-	case G_UNICODE_COMBINING_MARK:
-#endif
 	case G_UNICODE_ENCLOSING_MARK:
 		/* Ignore those */
 		break;
@@ -112,18 +104,9 @@ stripped_char (gunichar ch)
 	case G_UNICODE_SPACE_SEPARATOR:
 	default:
 		ch = g_unichar_tolower (ch);
-#if GLIB_CHECK_VERSION (2,29,90)
 		dlen = g_unichar_fully_decompose (ch, FALSE, decomp, 4);
-		if (dlen > 0) {
-#else
-		decomp = g_unicode_canonical_decomposition (ch, &dlen);
-		if (decomp != NULL) {
-#endif
+		if (dlen > 0)
 			retval = decomp[0];
-#if !GLIB_CHECK_VERSION (2,29,90)
-			g_free (decomp);
-#endif
-		}
 	}
 
 	return retval;
diff --git a/gcr/gcr-mock-prompter.c b/gcr/gcr-mock-prompter.c
index e72ef85..3e14403 100644
--- a/gcr/gcr-mock-prompter.c
+++ b/gcr/gcr-mock-prompter.c
@@ -965,24 +965,14 @@ gcr_mock_prompter_start (void)
 	g_assert (running == NULL);
 
 	running = g_new0 (ThreadData, 1);
-#if GLIB_CHECK_VERSION(2,31,3)
 	running->mutex = g_new0 (GMutex, 1);
 	g_mutex_init (running->mutex);
 	running->start_cond = g_new0 (GCond, 1);
 	g_cond_init (running->start_cond);
-#else
-	running->mutex = g_mutex_new ();
-	running->start_cond = g_cond_new ();
-#endif
 	g_queue_init (&running->responses);
 	g_mutex_lock (running->mutex);
 
-#if GLIB_CHECK_VERSION(2,31,3)
 	running->thread = g_thread_new ("mock-prompter", mock_prompter_thread, running);
-#else
-	running->thread = g_thread_create (mock_prompter_thread, running, TRUE, &error);
-#endif
-
 	if (error != NULL)
 		g_error ("mock prompter couldn't start thread: %s", error->message);
 
@@ -1018,15 +1008,10 @@ gcr_mock_prompter_stop (void)
 	g_queue_foreach (&running->responses, (GFunc)mock_response_free, NULL);
 	g_queue_clear (&running->responses);
 
-#if GLIB_CHECK_VERSION(2,31,3)
 	g_cond_clear (running->start_cond);
 	g_free (running->start_cond);
 	g_mutex_clear (running->mutex);
 	g_free (running->mutex);
-#else
-	g_cond_free (running->start_cond);
-	g_mutex_free (running->mutex);
-#endif
 
 	g_free (running);
 	running = NULL;
diff --git a/gcr/gcr-parser.c b/gcr/gcr-parser.c
index 430288a..0f81397 100644
--- a/gcr/gcr-parser.c
+++ b/gcr/gcr-parser.c
@@ -2570,11 +2570,7 @@ gcr_parsed_ref (GcrParsed *parsed)
 	g_return_val_if_fail (parsed != NULL, NULL);
 
 	/* Already had a reference */
-#if GLIB_CHECK_VERSION (2,29,90)
 	if (g_atomic_int_add (&parsed->refs, 1) >= 1)
-#else
-	if (g_atomic_int_exchange_and_add (&parsed->refs, 1) >= 1)
-#endif
 		return parsed;
 
 	/* If this is the first reference, flatten the stack of parsed */
diff --git a/gcr/gcr-system-prompt.c b/gcr/gcr-system-prompt.c
index b06358b..36c4500 100644
--- a/gcr/gcr-system-prompt.c
+++ b/gcr/gcr-system-prompt.c
@@ -382,11 +382,7 @@ gcr_system_prompt_constructed (GObject *obj)
 
 	G_OBJECT_CLASS (gcr_system_prompt_parent_class)->constructed (obj);
 
-#if GLIB_CHECK_VERSION (2,29,90)
 	seed = g_atomic_int_add (&unique_prompt_id, 1);
-#else
-	seed = g_atomic_int_exchange_and_add (&unique_prompt_id, 1);
-#endif
 
 	self->pv->prompt_path = g_strdup_printf ("%s/p%d", GCR_DBUS_PROMPT_OBJECT_PREFIX, seed);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]