Commit f318cdca authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Function to canonicalize parameter names. Faster than using g_strcanon().

2002-03-13  Alexander Larsson  <alla@lysator.liu.se>

	* gparam.c (canonalize_key):
	Function to canonicalize parameter names. Faster than
	using g_strcanon().
	(g_param_spec_internal, param_spec_ht_lookup):
	Use canonalize_key.
parent 738c1cfd
2002-03-13 Alexander Larsson <alla@lysator.liu.se>
* gparam.c (canonalize_key):
Function to canonicalize parameter names. Faster than
using g_strcanon().
(g_param_spec_internal, param_spec_ht_lookup):
Use canonalize_key.
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* gobject/gclosure.c
* gobject/gobject.c
* gobject/gsignal.c: fixed cast problems with function pointer
to avoid warnings (with forte compiler) (#73898)
2002-03-05 Sven Neumann <sven@gimp.org>
* gvaluetransform.c (g_value_transforms_init): don't try to
......
......@@ -257,6 +257,21 @@ g_param_spec_get_blurb (GParamSpec *pspec)
return pspec->_blurb;
}
static void
canonalize_key(gchar *key)
{
gchar *p, c;
for (p = key; (c = *p) != 0; p++)
{
if (c != '-' &&
(c < '0' || c > '9') &&
(c < 'A' || c > 'Z') &&
(c < 'a' || c > 'z'))
*p = '-';
}
}
gpointer
g_param_spec_internal (GType param_type,
const gchar *name,
......@@ -272,7 +287,7 @@ g_param_spec_internal (GType param_type,
pspec = (gpointer) g_type_create_instance (param_type);
pspec->name = g_strdup (name);
g_strcanon (pspec->name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
canonalize_key (pspec->name);
pspec->_nick = g_strdup (nick);
pspec->_blurb = g_strdup (blurb);
pspec->flags = (flags & G_PARAM_USER_MASK) | (flags & G_PARAM_MASK);
......@@ -650,7 +665,7 @@ param_spec_ht_lookup (GHashTable *hash_table,
key.name = g_strdup (param_name);
key.owner_type = owner_type;
g_strcanon (key.name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
canonalize_key (key.name);
if (walk_ancestors)
do
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment