mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-26 02:48:54 +02:00
Use g_once_init_{enter,leave}_pointer where appropriate
This should not result in any functional changes, but will eventually allow glib to be functional on CHERI-enabled systems such as Morello. Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
This commit is contained in:
committed by
Philip Withnall
parent
726eca7c89
commit
a1dfecf11f
@@ -294,10 +294,9 @@ gdbus_shared_thread_func (gpointer user_data)
|
||||
static SharedThreadData *
|
||||
_g_dbus_shared_thread_ref (void)
|
||||
{
|
||||
static gsize shared_thread_data = 0;
|
||||
SharedThreadData *ret;
|
||||
static SharedThreadData *shared_thread_data = 0;
|
||||
|
||||
if (g_once_init_enter (&shared_thread_data))
|
||||
if (g_once_init_enter_pointer (&shared_thread_data))
|
||||
{
|
||||
SharedThreadData *data;
|
||||
|
||||
@@ -310,12 +309,11 @@ _g_dbus_shared_thread_ref (void)
|
||||
gdbus_shared_thread_func,
|
||||
data);
|
||||
/* We can cast between gsize and gpointer safely */
|
||||
g_once_init_leave (&shared_thread_data, (gsize) data);
|
||||
g_once_init_leave_pointer (&shared_thread_data, data);
|
||||
}
|
||||
|
||||
ret = (SharedThreadData*) shared_thread_data;
|
||||
g_atomic_int_inc (&ret->refcount);
|
||||
return ret;
|
||||
g_atomic_int_inc (&shared_thread_data->refcount);
|
||||
return shared_thread_data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user