summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Lane <iainl@gnome.org>2018-07-11 10:18:08 +0100
committerIain Lane <iainl@gnome.org>2018-07-12 08:47:40 +0100
commit2aacef39b1cfe4cc5eade704db05ffe1516be22e (patch)
tree7be7f5e8f20e7cb1d30f49ad2e6b11c6290c3923
parent449dcca106d1f22ee279e4c4054e1907ebd2402c (diff)
downloadglib-2aacef39b1cfe4cc5eade704db05ffe1516be22e.tar.gz
gobject: Make g_clear_object take a non-volatile GObject **
The implementation is silently discarding this anyway, and g_object_unref() is using atomic operations. So this should be safe. Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer() is fixed to use __typeof__().
-rw-r--r--gobject/gobject.c2
-rw-r--r--gobject/gobject.h2
-rw-r--r--gobject/tests/reference.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 555ca3fae..efb8ecab5 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -3378,7 +3378,7 @@ g_object_unref (gpointer _object)
**/
#undef g_clear_object
void
-g_clear_object (volatile GObject **object_ptr)
+g_clear_object (GObject **object_ptr)
{
g_clear_pointer (object_ptr, g_object_unref);
}
diff --git a/gobject/gobject.h b/gobject/gobject.h
index 838046fe0..9abe87330 100644
--- a/gobject/gobject.h
+++ b/gobject/gobject.h
@@ -668,7 +668,7 @@ G_STMT_START { \
G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
GLIB_AVAILABLE_IN_ALL
-void g_clear_object (volatile GObject **object_ptr);
+void g_clear_object (GObject **object_ptr);
#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref)
/**
diff --git a/gobject/tests/reference.c b/gobject/tests/reference.c
index b05150e96..9508ee741 100644
--- a/gobject/tests/reference.c
+++ b/gobject/tests/reference.c
@@ -132,7 +132,7 @@ test_clear (void)
static void
test_clear_function (void)
{
- volatile GObject *o = NULL;
+ GObject *o = NULL;
GObject *tmp;
(g_clear_object) (&o);