mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-31 04:43:06 +02:00
glib: 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:
parent
9474655eb2
commit
1314ff93fc
@ -126,7 +126,7 @@ struct _GDateTime
|
|||||||
/* 1 is 0001-01-01 in Proleptic Gregorian */
|
/* 1 is 0001-01-01 in Proleptic Gregorian */
|
||||||
gint32 days;
|
gint32 days;
|
||||||
|
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Time conversion {{{1 */
|
/* Time conversion {{{1 */
|
||||||
|
@ -512,7 +512,7 @@ struct _GKeyFile
|
|||||||
|
|
||||||
gchar **locales;
|
gchar **locales;
|
||||||
|
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GKeyFileKeyValuePair GKeyFileKeyValuePair;
|
typedef struct _GKeyFileKeyValuePair GKeyFileKeyValuePair;
|
||||||
|
@ -272,7 +272,7 @@ struct _GMainContext
|
|||||||
guint owner_count;
|
guint owner_count;
|
||||||
GSList *waiters;
|
GSList *waiters;
|
||||||
|
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
|
|
||||||
GHashTable *sources; /* guint -> GSource */
|
GHashTable *sources; /* guint -> GSource */
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ struct _GMainContext
|
|||||||
|
|
||||||
struct _GSourceCallback
|
struct _GSourceCallback
|
||||||
{
|
{
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
GSourceFunc func;
|
GSourceFunc func;
|
||||||
gpointer data;
|
gpointer data;
|
||||||
GDestroyNotify notify;
|
GDestroyNotify notify;
|
||||||
@ -313,7 +313,7 @@ struct _GMainLoop
|
|||||||
{
|
{
|
||||||
GMainContext *context;
|
GMainContext *context;
|
||||||
gboolean is_running; /* (atomic) */
|
gboolean is_running; /* (atomic) */
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GTimeoutSource
|
struct _GTimeoutSource
|
||||||
@ -4749,7 +4749,7 @@ g_main_context_get_poll_func (GMainContext *context)
|
|||||||
*
|
*
|
||||||
* |[<!-- language="C" -->
|
* |[<!-- language="C" -->
|
||||||
* #define NUM_TASKS 10
|
* #define NUM_TASKS 10
|
||||||
* static volatile gint tasks_remaining = NUM_TASKS;
|
* static gint tasks_remaining = NUM_TASKS; // (atomic)
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
* while (g_atomic_int_get (&tasks_remaining) != 0)
|
* while (g_atomic_int_get (&tasks_remaining) != 0)
|
||||||
|
@ -119,7 +119,7 @@ struct _GMarkupParseContext
|
|||||||
{
|
{
|
||||||
const GMarkupParser *parser;
|
const GMarkupParser *parser;
|
||||||
|
|
||||||
volatile gint ref_count;
|
gint ref_count; /* (atomic) */
|
||||||
|
|
||||||
GMarkupParseFlags flags;
|
GMarkupParseFlags flags;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ G_STATIC_ASSERT (G_REGEX_RAW == PCRE_UTF8);
|
|||||||
|
|
||||||
struct _GMatchInfo
|
struct _GMatchInfo
|
||||||
{
|
{
|
||||||
volatile gint ref_count; /* the ref count */
|
gint ref_count; /* the ref count (atomic) */
|
||||||
GRegex *regex; /* the regex */
|
GRegex *regex; /* the regex */
|
||||||
GRegexMatchFlags match_opts; /* options used at match time on the regex */
|
GRegexMatchFlags match_opts; /* options used at match time on the regex */
|
||||||
gint matches; /* number of matching sub patterns */
|
gint matches; /* number of matching sub patterns */
|
||||||
@ -218,7 +218,7 @@ struct _GMatchInfo
|
|||||||
|
|
||||||
struct _GRegex
|
struct _GRegex
|
||||||
{
|
{
|
||||||
volatile gint ref_count; /* the ref count for the immutable part */
|
gint ref_count; /* the ref count for the immutable part (atomic) */
|
||||||
gchar *pattern; /* the pattern */
|
gchar *pattern; /* the pattern */
|
||||||
pcre *pcre_re; /* compiled form of the pattern */
|
pcre *pcre_re; /* compiled form of the pattern */
|
||||||
GRegexCompileFlags compile_opts; /* options used at compile time on the pattern */
|
GRegexCompileFlags compile_opts; /* options used at compile time on the pattern */
|
||||||
@ -1300,7 +1300,7 @@ g_regex_new (const gchar *pattern,
|
|||||||
pcre *re;
|
pcre *re;
|
||||||
const gchar *errmsg;
|
const gchar *errmsg;
|
||||||
gboolean optimize = FALSE;
|
gboolean optimize = FALSE;
|
||||||
static volatile gsize initialised = 0;
|
static gsize initialised = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (pattern != NULL, NULL);
|
g_return_val_if_fail (pattern != NULL, NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
@ -513,7 +513,7 @@ static GMutex g_once_mutex;
|
|||||||
static GCond g_once_cond;
|
static GCond g_once_cond;
|
||||||
static GSList *g_once_init_list = NULL;
|
static GSList *g_once_init_list = NULL;
|
||||||
|
|
||||||
static volatile guint g_thread_n_created_counter = 0;
|
static guint g_thread_n_created_counter = 0; /* (atomic) */
|
||||||
|
|
||||||
static void g_thread_cleanup (gpointer data);
|
static void g_thread_cleanup (gpointer data);
|
||||||
static GPrivate g_thread_specific_private = G_PRIVATE_INIT (g_thread_cleanup);
|
static GPrivate g_thread_specific_private = G_PRIVATE_INIT (g_thread_cleanup);
|
||||||
@ -694,7 +694,7 @@ g_once_impl (GOnce *once,
|
|||||||
gboolean
|
gboolean
|
||||||
(g_once_init_enter) (volatile void *location)
|
(g_once_init_enter) (volatile void *location)
|
||||||
{
|
{
|
||||||
volatile gsize *value_location = location;
|
gsize *value_location = (gsize *) location;
|
||||||
gboolean need_init = FALSE;
|
gboolean need_init = FALSE;
|
||||||
g_mutex_lock (&g_once_mutex);
|
g_mutex_lock (&g_once_mutex);
|
||||||
if (g_atomic_pointer_get (value_location) == 0)
|
if (g_atomic_pointer_get (value_location) == 0)
|
||||||
@ -731,7 +731,7 @@ void
|
|||||||
(g_once_init_leave) (volatile void *location,
|
(g_once_init_leave) (volatile void *location,
|
||||||
gsize result)
|
gsize result)
|
||||||
{
|
{
|
||||||
volatile gsize *value_location = location;
|
gsize *value_location = (gsize *) location;
|
||||||
|
|
||||||
g_return_if_fail (g_atomic_pointer_get (value_location) == 0);
|
g_return_if_fail (g_atomic_pointer_get (value_location) == 0);
|
||||||
g_return_if_fail (result != 0);
|
g_return_if_fail (result != 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user