mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-21 17:37:53 +02:00
gobject: Drop use of volatile from get_type() macros
http://isvolatileusefulwiththreads.in/c/ It’s possible that the variables here are only marked as volatile because they’re arguments to `g_once_*()`. Those arguments will be modified in a subsequent commit. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #600
This commit is contained in:
@@ -480,9 +480,9 @@ A C source template file will typically look like this:
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static volatile gsize g_@type@_type_id__volatile;
|
||||
static gsize static_g_@type@_type_id;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
if (g_once_init_enter (&static_g_@type@_type_id))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
@@ -498,9 +498,9 @@ GType
|
||||
GType g_@type@_type_id =
|
||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
||||
|
||||
g_once_init_leave (&g_@type@_type_id__volatile, g_@type@_type_id);
|
||||
g_once_init_leave (&static_g_@type@_type_id, g_@type@_type_id);
|
||||
}
|
||||
return g_@type@_type_id__volatile;
|
||||
return static_g_@type@_type_id;
|
||||
}
|
||||
|
||||
/*** END value-tail ***/
|
||||
|
@@ -852,7 +852,7 @@ viewer_editable_default_init (ViewerEditableInterface *iface)
|
||||
GType
|
||||
viewer_editable_get_type (void)
|
||||
{
|
||||
static volatile gsize type_id = 0;
|
||||
static gsize type_id = 0;
|
||||
if (g_once_init_enter (&type_id)) {
|
||||
const GTypeInfo info = {
|
||||
sizeof (ViewerEditableInterface),
|
||||
|
Reference in New Issue
Block a user