Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 1 | From 74250cd9c9dfd3ad428e445c095ceac88ba18691 Mon Sep 17 00:00:00 2001 |
| 2 | From: Philip Withnall <pwithnall@endlessos.org> |
| 3 | Date: Wed, 11 Nov 2020 18:28:23 +0000 |
| 4 | Subject: [PATCH 09/29] gio: Drop unnecessary volatile qualifiers from internal |
| 5 | variables |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | These variables were already (correctly) accessed atomically. The |
| 11 | `volatile` qualifier doesn’t help with that. |
| 12 | |
| 13 | Signed-off-by: Philip Withnall <pwithnall@endlessos.org> |
| 14 | |
| 15 | Helps: #600 |
| 16 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719] |
| 17 | --- |
| 18 | gio/gdbusinterfaceskeleton.c | 2 +- |
| 19 | gio/gdbusintrospection.h | 14 +++++++------- |
| 20 | gio/gdbusnameowning.c | 4 ++-- |
| 21 | gio/gdbusnamewatching.c | 4 ++-- |
| 22 | gio/gdbusprivate.c | 10 +++++----- |
| 23 | gio/gnetworking.c | 2 +- |
| 24 | 6 files changed, 18 insertions(+), 18 deletions(-) |
| 25 | |
| 26 | diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c |
| 27 | index 243b4a0a4..76398df36 100644 |
| 28 | --- a/gio/gdbusinterfaceskeleton.c |
| 29 | +++ b/gio/gdbusinterfaceskeleton.c |
| 30 | @@ -458,7 +458,7 @@ dbus_interface_interface_init (GDBusInterfaceIface *iface) |
| 31 | |
| 32 | typedef struct |
| 33 | { |
| 34 | - volatile gint ref_count; |
| 35 | + gint ref_count; /* (atomic) */ |
| 36 | GDBusInterfaceSkeleton *interface; |
| 37 | GDBusInterfaceMethodCallFunc method_call_func; |
| 38 | GDBusMethodInvocation *invocation; |
| 39 | diff --git a/gio/gdbusintrospection.h b/gio/gdbusintrospection.h |
| 40 | index 14b171055..f2e291787 100644 |
| 41 | --- a/gio/gdbusintrospection.h |
| 42 | +++ b/gio/gdbusintrospection.h |
| 43 | @@ -43,7 +43,7 @@ G_BEGIN_DECLS |
| 44 | struct _GDBusAnnotationInfo |
| 45 | { |
| 46 | /*< public >*/ |
| 47 | - volatile gint ref_count; |
| 48 | + gint ref_count; /* (atomic) */ |
| 49 | gchar *key; |
| 50 | gchar *value; |
| 51 | GDBusAnnotationInfo **annotations; |
| 52 | @@ -63,7 +63,7 @@ struct _GDBusAnnotationInfo |
| 53 | struct _GDBusArgInfo |
| 54 | { |
| 55 | /*< public >*/ |
| 56 | - volatile gint ref_count; |
| 57 | + gint ref_count; /* (atomic) */ |
| 58 | gchar *name; |
| 59 | gchar *signature; |
| 60 | GDBusAnnotationInfo **annotations; |
| 61 | @@ -84,7 +84,7 @@ struct _GDBusArgInfo |
| 62 | struct _GDBusMethodInfo |
| 63 | { |
| 64 | /*< public >*/ |
| 65 | - volatile gint ref_count; |
| 66 | + gint ref_count; /* (atomic) */ |
| 67 | gchar *name; |
| 68 | GDBusArgInfo **in_args; |
| 69 | GDBusArgInfo **out_args; |
| 70 | @@ -105,7 +105,7 @@ struct _GDBusMethodInfo |
| 71 | struct _GDBusSignalInfo |
| 72 | { |
| 73 | /*< public >*/ |
| 74 | - volatile gint ref_count; |
| 75 | + gint ref_count; /* (atomic) */ |
| 76 | gchar *name; |
| 77 | GDBusArgInfo **args; |
| 78 | GDBusAnnotationInfo **annotations; |
| 79 | @@ -126,7 +126,7 @@ struct _GDBusSignalInfo |
| 80 | struct _GDBusPropertyInfo |
| 81 | { |
| 82 | /*< public >*/ |
| 83 | - volatile gint ref_count; |
| 84 | + gint ref_count; /* (atomic) */ |
| 85 | gchar *name; |
| 86 | gchar *signature; |
| 87 | GDBusPropertyInfoFlags flags; |
| 88 | @@ -149,7 +149,7 @@ struct _GDBusPropertyInfo |
| 89 | struct _GDBusInterfaceInfo |
| 90 | { |
| 91 | /*< public >*/ |
| 92 | - volatile gint ref_count; |
| 93 | + gint ref_count; /* (atomic) */ |
| 94 | gchar *name; |
| 95 | GDBusMethodInfo **methods; |
| 96 | GDBusSignalInfo **signals; |
| 97 | @@ -172,7 +172,7 @@ struct _GDBusInterfaceInfo |
| 98 | struct _GDBusNodeInfo |
| 99 | { |
| 100 | /*< public >*/ |
| 101 | - volatile gint ref_count; |
| 102 | + gint ref_count; /* (atomic) */ |
| 103 | gchar *path; |
| 104 | GDBusInterfaceInfo **interfaces; |
| 105 | GDBusNodeInfo **nodes; |
| 106 | diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c |
| 107 | index d20e6ffed..1130d6789 100644 |
| 108 | --- a/gio/gdbusnameowning.c |
| 109 | +++ b/gio/gdbusnameowning.c |
| 110 | @@ -55,7 +55,7 @@ typedef enum |
| 111 | |
| 112 | typedef struct |
| 113 | { |
| 114 | - volatile gint ref_count; |
| 115 | + gint ref_count; /* (atomic) */ |
| 116 | guint id; |
| 117 | GBusNameOwnerFlags flags; |
| 118 | gchar *name; |
| 119 | @@ -73,7 +73,7 @@ typedef struct |
| 120 | guint name_acquired_subscription_id; |
| 121 | guint name_lost_subscription_id; |
| 122 | |
| 123 | - volatile gboolean cancelled; /* must hold lock when reading or modifying */ |
| 124 | + gboolean cancelled; /* must hold lock when reading or modifying */ |
| 125 | |
| 126 | gboolean needs_release; |
| 127 | } Client; |
| 128 | diff --git a/gio/gdbusnamewatching.c b/gio/gdbusnamewatching.c |
| 129 | index bc2a9119e..8d24700c5 100644 |
| 130 | --- a/gio/gdbusnamewatching.c |
| 131 | +++ b/gio/gdbusnamewatching.c |
| 132 | @@ -56,7 +56,7 @@ typedef enum |
| 133 | |
| 134 | typedef struct |
| 135 | { |
| 136 | - volatile gint ref_count; |
| 137 | + gint ref_count; /* (atomic) */ |
| 138 | guint id; |
| 139 | gchar *name; |
| 140 | GBusNameWatcherFlags flags; |
| 141 | @@ -78,7 +78,7 @@ typedef struct |
| 142 | } Client; |
| 143 | |
| 144 | /* Must be accessed atomically. */ |
| 145 | -static volatile guint next_global_id = 1; |
| 146 | +static guint next_global_id = 1; /* (atomic) */ |
| 147 | |
| 148 | /* Must be accessed with @lock held. */ |
| 149 | static GHashTable *map_id_to_client = NULL; |
| 150 | diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c |
| 151 | index 2551e4791..99b37f3eb 100644 |
| 152 | --- a/gio/gdbusprivate.c |
| 153 | +++ b/gio/gdbusprivate.c |
| 154 | @@ -265,7 +265,7 @@ ensure_required_types (void) |
| 155 | |
| 156 | typedef struct |
| 157 | { |
| 158 | - volatile gint refcount; |
| 159 | + gint refcount; /* (atomic) */ |
| 160 | GThread *thread; |
| 161 | GMainContext *context; |
| 162 | GMainLoop *loop; |
| 163 | @@ -341,12 +341,12 @@ typedef enum { |
| 164 | |
| 165 | struct GDBusWorker |
| 166 | { |
| 167 | - volatile gint ref_count; |
| 168 | + gint ref_count; /* (atomic) */ |
| 169 | |
| 170 | SharedThreadData *shared_thread_data; |
| 171 | |
| 172 | /* really a boolean, but GLib 2.28 lacks atomic boolean ops */ |
| 173 | - volatile gint stopped; |
| 174 | + gint stopped; /* (atomic) */ |
| 175 | |
| 176 | /* TODO: frozen (e.g. G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) currently |
| 177 | * only affects messages received from the other peer (since GDBusServer is the |
| 178 | @@ -1941,11 +1941,11 @@ _g_dbus_debug_print_unlock (void) |
| 179 | void |
| 180 | _g_dbus_initialize (void) |
| 181 | { |
| 182 | - static volatile gsize initialized = 0; |
| 183 | + static gsize initialized = 0; |
| 184 | |
| 185 | if (g_once_init_enter (&initialized)) |
| 186 | { |
| 187 | - volatile GQuark g_dbus_error_domain; |
| 188 | + GQuark g_dbus_error_domain; |
| 189 | const gchar *debug; |
| 190 | |
| 191 | g_dbus_error_domain = G_DBUS_ERROR; |
| 192 | diff --git a/gio/gnetworking.c b/gio/gnetworking.c |
| 193 | index 05507fe70..7bc6d73c4 100644 |
| 194 | --- a/gio/gnetworking.c |
| 195 | +++ b/gio/gnetworking.c |
| 196 | @@ -61,7 +61,7 @@ void |
| 197 | g_networking_init (void) |
| 198 | { |
| 199 | #ifdef G_OS_WIN32 |
| 200 | - static volatile gsize inited = 0; |
| 201 | + static gsize inited = 0; |
| 202 | |
| 203 | if (g_once_init_enter (&inited)) |
| 204 | { |
| 205 | -- |
| 206 | 2.30.1 |
| 207 | |