From 714a0aa47d9b1d9b7c878441d477508e7161ffe8 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 9 Jun 2022 18:20:06 +0100 Subject: [PATCH] gbinding: Remove some duplicated code for checking property names GObject already exports a public symbol for this with identical code. Signed-off-by: Philip Withnall --- gobject/gbinding.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/gobject/gbinding.c b/gobject/gbinding.c index a0b5de102..eede10bdc 100644 --- a/gobject/gbinding.c +++ b/gobject/gbinding.c @@ -699,30 +699,6 @@ is_canonical (const gchar *key) return (strchr (key, '_') == NULL); } -static gboolean -is_valid_property_name (const gchar *key) -{ - const gchar *p; - - /* First character must be a letter. */ - if ((key[0] < 'A' || key[0] > 'Z') && - (key[0] < 'a' || key[0] > 'z')) - return FALSE; - - for (p = key; *p != 0; p++) - { - const gchar c = *p; - - if (c != '-' && c != '_' && - (c < '0' || c > '9') && - (c < 'A' || c > 'Z') && - (c < 'a' || c > 'z')) - return FALSE; - } - - return TRUE; -} - static void g_binding_set_property (GObject *gobject, guint prop_id, @@ -1268,10 +1244,10 @@ g_object_bind_property_full (gpointer source, g_return_val_if_fail (G_IS_OBJECT (source), NULL); g_return_val_if_fail (source_property != NULL, NULL); - g_return_val_if_fail (is_valid_property_name (source_property), NULL); + g_return_val_if_fail (g_param_spec_is_valid_name (source_property), NULL); g_return_val_if_fail (G_IS_OBJECT (target), NULL); g_return_val_if_fail (target_property != NULL, NULL); - g_return_val_if_fail (is_valid_property_name (target_property), NULL); + g_return_val_if_fail (g_param_spec_is_valid_name (target_property), NULL); if (source == target && g_strcmp0 (source_property, target_property) == 0) {