From 49bfa7b9cf8b16f7f6a5b1db565575d61a37100f Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 20 Sep 2024 12:45:30 -0700 Subject: [PATCH] gvarianttype: mark const functions as such These functions only rely on their input parameter and no globals, thus are candidates for sub-expression elimination. --- glib/gvarianttype.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/glib/gvarianttype.h b/glib/gvarianttype.h index 0fc751bcb..64cc84665 100644 --- a/glib/gvarianttype.h +++ b/glib/gvarianttype.h @@ -286,7 +286,7 @@ typedef struct _GVariantType GVariantType; /* type string checking */ GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_string_is_valid (const gchar *type_string); +gboolean g_variant_type_string_is_valid (const gchar *type_string) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_variant_type_string_scan (const gchar *string, const gchar *limit, @@ -310,21 +310,21 @@ gchar * g_variant_type_dup_string (const G /* classification */ GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_definite (const GVariantType *type); +gboolean g_variant_type_is_definite (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_container (const GVariantType *type); +gboolean g_variant_type_is_container (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_basic (const GVariantType *type); +gboolean g_variant_type_is_basic (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_maybe (const GVariantType *type); +gboolean g_variant_type_is_maybe (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_array (const GVariantType *type); +gboolean g_variant_type_is_array (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_tuple (const GVariantType *type); +gboolean g_variant_type_is_tuple (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_dict_entry (const GVariantType *type); +gboolean g_variant_type_is_dict_entry (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_variant (const GVariantType *type); +gboolean g_variant_type_is_variant (const GVariantType *type) G_GNUC_CONST; /* for hash tables */ GLIB_AVAILABLE_IN_ALL @@ -336,21 +336,21 @@ gboolean g_variant_type_equal (gconstp /* subtypes */ GLIB_AVAILABLE_IN_ALL gboolean g_variant_type_is_subtype_of (const GVariantType *type, - const GVariantType *supertype); + const GVariantType *supertype) G_GNUC_CONST; /* type iterator interface */ GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_element (const GVariantType *type); +const GVariantType * g_variant_type_element (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_first (const GVariantType *type); +const GVariantType * g_variant_type_first (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_next (const GVariantType *type); +const GVariantType * g_variant_type_next (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -gsize g_variant_type_n_items (const GVariantType *type); +gsize g_variant_type_n_items (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_key (const GVariantType *type); +const GVariantType * g_variant_type_key (const GVariantType *type) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_value (const GVariantType *type); +const GVariantType * g_variant_type_value (const GVariantType *type) G_GNUC_CONST; /* constructors */ GLIB_AVAILABLE_IN_ALL