[glib: 9/30] gio: Drop unnecessary volatile qualifiers from internal variables




commit 74250cd9c9dfd3ad428e445c095ceac88ba18691
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Nov 11 18:28:23 2020 +0000

    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

 gio/gdbusinterfaceskeleton.c |  2 +-
 gio/gdbusintrospection.h     | 14 +++++++-------
 gio/gdbusnameowning.c        |  4 ++--
 gio/gdbusnamewatching.c      |  4 ++--
 gio/gdbusprivate.c           | 10 +++++-----
 gio/gnetworking.c            |  2 +-
 6 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c
index 243b4a0a4..76398df36 100644
--- a/gio/gdbusinterfaceskeleton.c
+++ b/gio/gdbusinterfaceskeleton.c
@@ -458,7 +458,7 @@ dbus_interface_interface_init (GDBusInterfaceIface *iface)
 
 typedef struct
 {
-  volatile gint ref_count;
+  gint ref_count;  /* (atomic) */
   GDBusInterfaceSkeleton       *interface;
   GDBusInterfaceMethodCallFunc  method_call_func;
   GDBusMethodInvocation        *invocation;
diff --git a/gio/gdbusintrospection.h b/gio/gdbusintrospection.h
index 14b171055..f2e291787 100644
--- a/gio/gdbusintrospection.h
+++ b/gio/gdbusintrospection.h
@@ -43,7 +43,7 @@ G_BEGIN_DECLS
 struct _GDBusAnnotationInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *key;
   gchar                *value;
   GDBusAnnotationInfo **annotations;
@@ -63,7 +63,7 @@ struct _GDBusAnnotationInfo
 struct _GDBusArgInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *name;
   gchar                *signature;
   GDBusAnnotationInfo **annotations;
@@ -84,7 +84,7 @@ struct _GDBusArgInfo
 struct _GDBusMethodInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *name;
   GDBusArgInfo        **in_args;
   GDBusArgInfo        **out_args;
@@ -105,7 +105,7 @@ struct _GDBusMethodInfo
 struct _GDBusSignalInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *name;
   GDBusArgInfo        **args;
   GDBusAnnotationInfo **annotations;
@@ -126,7 +126,7 @@ struct _GDBusSignalInfo
 struct _GDBusPropertyInfo
 {
   /*< public >*/
-  volatile gint             ref_count;
+  gint                      ref_count;  /* (atomic) */
   gchar                    *name;
   gchar                    *signature;
   GDBusPropertyInfoFlags    flags;
@@ -149,7 +149,7 @@ struct _GDBusPropertyInfo
 struct _GDBusInterfaceInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *name;
   GDBusMethodInfo     **methods;
   GDBusSignalInfo     **signals;
@@ -172,7 +172,7 @@ struct _GDBusInterfaceInfo
 struct _GDBusNodeInfo
 {
   /*< public >*/
-  volatile gint         ref_count;
+  gint                  ref_count;  /* (atomic) */
   gchar                *path;
   GDBusInterfaceInfo  **interfaces;
   GDBusNodeInfo       **nodes;
diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c
index d20e6ffed..1130d6789 100644
--- a/gio/gdbusnameowning.c
+++ b/gio/gdbusnameowning.c
@@ -55,7 +55,7 @@ typedef enum
 
 typedef struct
 {
-  volatile gint             ref_count;
+  gint                      ref_count;  /* (atomic) */
   guint                     id;
   GBusNameOwnerFlags        flags;
   gchar                    *name;
@@ -73,7 +73,7 @@ typedef struct
   guint                     name_acquired_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;
 } Client;
diff --git a/gio/gdbusnamewatching.c b/gio/gdbusnamewatching.c
index bc2a9119e..8d24700c5 100644
--- a/gio/gdbusnamewatching.c
+++ b/gio/gdbusnamewatching.c
@@ -56,7 +56,7 @@ typedef enum
 
 typedef struct
 {
-  volatile gint             ref_count;
+  gint                      ref_count;  /* (atomic) */
   guint                     id;
   gchar                    *name;
   GBusNameWatcherFlags      flags;
@@ -78,7 +78,7 @@ typedef struct
 } Client;
 
 /* Must be accessed atomically. */
-static volatile guint next_global_id = 1;
+static guint next_global_id = 1;  /* (atomic) */
 
 /* Must be accessed with @lock held. */
 static GHashTable *map_id_to_client = NULL;
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 2551e4791..99b37f3eb 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -265,7 +265,7 @@ ensure_required_types (void)
 
 typedef struct
 {
-  volatile gint refcount;
+  gint refcount;  /* (atomic) */
   GThread *thread;
   GMainContext *context;
   GMainLoop *loop;
@@ -341,12 +341,12 @@ typedef enum {
 
 struct GDBusWorker
 {
-  volatile gint                       ref_count;
+  gint                                ref_count;  /* (atomic) */
 
   SharedThreadData                   *shared_thread_data;
 
   /* 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
    * only affects messages received from the other peer (since GDBusServer is the
@@ -1941,11 +1941,11 @@ _g_dbus_debug_print_unlock (void)
 void
 _g_dbus_initialize (void)
 {
-  static volatile gsize initialized = 0;
+  static gsize initialized = 0;
 
   if (g_once_init_enter (&initialized))
     {
-      volatile GQuark g_dbus_error_domain;
+      GQuark g_dbus_error_domain;
       const gchar *debug;
 
       g_dbus_error_domain = G_DBUS_ERROR;
diff --git a/gio/gnetworking.c b/gio/gnetworking.c
index 05507fe70..7bc6d73c4 100644
--- a/gio/gnetworking.c
+++ b/gio/gnetworking.c
@@ -61,7 +61,7 @@ void
 g_networking_init (void)
 {
 #ifdef G_OS_WIN32
-  static volatile gsize inited = 0;
+  static gsize inited = 0;
 
   if (g_once_init_enter (&inited))
     {


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