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;
}
gint egg_tests_run_with_loop (void);
-gint egg_tests_run_with_loop (void);
-
#endif /* EGG_DH_H_ */
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()");
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;
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);
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);
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
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);
}
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);
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;
{
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 */
{
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);
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;
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;
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);
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;
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 */
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);