From a05a21bec2f09a7454aea27a0f8aa4739b686878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 5 Feb 2018 16:35:14 +0200 Subject: [PATCH] =?UTF-8?q?GValue=20=E2=80=93=20Don't=20cast=20G=5FVALUE?= =?UTF-8?q?=5FTYPE()=20argument=20to=20GValue*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not possible to subclass GValue, and by always explicitly casting here it is easy to write broken code (e.g. passing a GValue**) without the compiler warning about that. By not casting, the compiler will error out if anything but a GValue* is passed here. https://bugzilla.gnome.org/show_bug.cgi?id=793186 --- gobject/gvalue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gvalue.h b/gobject/gvalue.h index 9d8f03482..37e1aa480 100644 --- a/gobject/gvalue.h +++ b/gobject/gvalue.h @@ -56,7 +56,7 @@ G_BEGIN_DECLS * * Returns: the #GType. */ -#define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) +#define G_VALUE_TYPE(value) (((value))->g_type) /** * G_VALUE_TYPE_NAME: * @value: A #GValue structure.