GValue – Don't cast G_VALUE_TYPE() argument to GValue*

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
This commit is contained in:
Sebastian Dröge 2018-02-05 16:35:14 +02:00 committed by Philip Withnall
parent e9dd5e1819
commit a05a21bec2

View File

@ -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.