gio: Drop unnecessary volatile qualifiers from internal variables

These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
This commit is contained in:
Philip Withnall 2020-11-11 18:28:23 +00:00
parent 7c7623c4a3
commit 74250cd9c9
6 changed files with 18 additions and 18 deletions

View File

@ -458,7 +458,7 @@ dbus_interface_interface_init (GDBusInterfaceIface *iface)
typedef struct typedef struct
{ {
volatile gint ref_count; gint ref_count; /* (atomic) */
GDBusInterfaceSkeleton *interface; GDBusInterfaceSkeleton *interface;
GDBusInterfaceMethodCallFunc method_call_func; GDBusInterfaceMethodCallFunc method_call_func;
GDBusMethodInvocation *invocation; GDBusMethodInvocation *invocation;

View File

@ -43,7 +43,7 @@ G_BEGIN_DECLS
struct _GDBusAnnotationInfo struct _GDBusAnnotationInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *key; gchar *key;
gchar *value; gchar *value;
GDBusAnnotationInfo **annotations; GDBusAnnotationInfo **annotations;
@ -63,7 +63,7 @@ struct _GDBusAnnotationInfo
struct _GDBusArgInfo struct _GDBusArgInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *name; gchar *name;
gchar *signature; gchar *signature;
GDBusAnnotationInfo **annotations; GDBusAnnotationInfo **annotations;
@ -84,7 +84,7 @@ struct _GDBusArgInfo
struct _GDBusMethodInfo struct _GDBusMethodInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *name; gchar *name;
GDBusArgInfo **in_args; GDBusArgInfo **in_args;
GDBusArgInfo **out_args; GDBusArgInfo **out_args;
@ -105,7 +105,7 @@ struct _GDBusMethodInfo
struct _GDBusSignalInfo struct _GDBusSignalInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *name; gchar *name;
GDBusArgInfo **args; GDBusArgInfo **args;
GDBusAnnotationInfo **annotations; GDBusAnnotationInfo **annotations;
@ -126,7 +126,7 @@ struct _GDBusSignalInfo
struct _GDBusPropertyInfo struct _GDBusPropertyInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *name; gchar *name;
gchar *signature; gchar *signature;
GDBusPropertyInfoFlags flags; GDBusPropertyInfoFlags flags;
@ -149,7 +149,7 @@ struct _GDBusPropertyInfo
struct _GDBusInterfaceInfo struct _GDBusInterfaceInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *name; gchar *name;
GDBusMethodInfo **methods; GDBusMethodInfo **methods;
GDBusSignalInfo **signals; GDBusSignalInfo **signals;
@ -172,7 +172,7 @@ struct _GDBusInterfaceInfo
struct _GDBusNodeInfo struct _GDBusNodeInfo
{ {
/*< public >*/ /*< public >*/
volatile gint ref_count; gint ref_count; /* (atomic) */
gchar *path; gchar *path;
GDBusInterfaceInfo **interfaces; GDBusInterfaceInfo **interfaces;
GDBusNodeInfo **nodes; GDBusNodeInfo **nodes;

View File

@ -55,7 +55,7 @@ typedef enum
typedef struct typedef struct
{ {
volatile gint ref_count; gint ref_count; /* (atomic) */
guint id; guint id;
GBusNameOwnerFlags flags; GBusNameOwnerFlags flags;
gchar *name; gchar *name;
@ -73,7 +73,7 @@ typedef struct
guint name_acquired_subscription_id; guint name_acquired_subscription_id;
guint name_lost_subscription_id; guint name_lost_subscription_id;
volatile gboolean cancelled; /* must hold lock when reading or modifying */ gboolean cancelled; /* must hold lock when reading or modifying */
gboolean needs_release; gboolean needs_release;
} Client; } Client;

View File

@ -56,7 +56,7 @@ typedef enum
typedef struct typedef struct
{ {
volatile gint ref_count; gint ref_count; /* (atomic) */
guint id; guint id;
gchar *name; gchar *name;
GBusNameWatcherFlags flags; GBusNameWatcherFlags flags;
@ -78,7 +78,7 @@ typedef struct
} Client; } Client;
/* Must be accessed atomically. */ /* Must be accessed atomically. */
static volatile guint next_global_id = 1; static guint next_global_id = 1; /* (atomic) */
/* Must be accessed with @lock held. */ /* Must be accessed with @lock held. */
static GHashTable *map_id_to_client = NULL; static GHashTable *map_id_to_client = NULL;

View File

@ -265,7 +265,7 @@ ensure_required_types (void)
typedef struct typedef struct
{ {
volatile gint refcount; gint refcount; /* (atomic) */
GThread *thread; GThread *thread;
GMainContext *context; GMainContext *context;
GMainLoop *loop; GMainLoop *loop;
@ -341,12 +341,12 @@ typedef enum {
struct GDBusWorker struct GDBusWorker
{ {
volatile gint ref_count; gint ref_count; /* (atomic) */
SharedThreadData *shared_thread_data; SharedThreadData *shared_thread_data;
/* really a boolean, but GLib 2.28 lacks atomic boolean ops */ /* really a boolean, but GLib 2.28 lacks atomic boolean ops */
volatile gint stopped; gint stopped; /* (atomic) */
/* TODO: frozen (e.g. G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) currently /* TODO: frozen (e.g. G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) currently
* only affects messages received from the other peer (since GDBusServer is the * only affects messages received from the other peer (since GDBusServer is the
@ -1941,11 +1941,11 @@ _g_dbus_debug_print_unlock (void)
void void
_g_dbus_initialize (void) _g_dbus_initialize (void)
{ {
static volatile gsize initialized = 0; static gsize initialized = 0;
if (g_once_init_enter (&initialized)) if (g_once_init_enter (&initialized))
{ {
volatile GQuark g_dbus_error_domain; GQuark g_dbus_error_domain;
const gchar *debug; const gchar *debug;
g_dbus_error_domain = G_DBUS_ERROR; g_dbus_error_domain = G_DBUS_ERROR;

View File

@ -61,7 +61,7 @@ void
g_networking_init (void) g_networking_init (void)
{ {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
static volatile gsize inited = 0; static gsize inited = 0;
if (g_once_init_enter (&inited)) if (g_once_init_enter (&inited))
{ {