glib/gvarianttype: use G_DISABLE_CAST_CHECKS

Previously, G_VARIANT_TYPE() would "cast check" the type string unless
G_DISABLE_CHECKS was set. We very much don't want people to ever set
G_DISABLE_CHECKS but it is extremely normal to turn of cast-checks using
G_DISASABLE_CAST_CHECKS in stable releases.

This allows disabling the expensive type checking without catastrophically
disabling g_return_if_fail() macros.
This commit is contained in:
Christian Hergert 2024-09-23 16:03:36 -07:00
parent 9eb9df2396
commit 786a5d364c

View File

@ -278,7 +278,7 @@ typedef struct _GVariantType GVariantType;
*
* Since 2.24
**/
#ifndef G_DISABLE_CHECKS
#ifndef G_DISABLE_CAST_CHECKS
# define G_VARIANT_TYPE(type_string) (g_variant_type_checked_ ((type_string)))
#else
# define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string))