Re: silent property name canonization



Joshua N Pritikin <vishnu pobox com> writes:
> i just wasted two hours because the following warning was missing
> from gparam.c:
> 
> --- gparam.c.orig	Thu Aug 30 13:29:17 2001
> +++ gparam.c	Thu Aug 30 13:30:22 2001
> @@ -250,6 +250,8 @@ g_param_spec_internal (GType        para
>    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 "-", '-');
> +  if (strcmp (name, pspec->name) != 0)
> +    g_warning ("Property name `%s' canonized to `%s'", name, pspec->name);
>    pspec->nick = g_strdup (nick ? nick : pspec->name);
>    pspec->blurb = g_strdup (blurb);
>    pspec->flags = (flags & G_PARAM_USER_MASK) | (flags & G_PARAM_MASK);
> 
> Now don't take this too seriously.  i understand why this patch isn't
> already part of gobject.  Still, it's frustrating.

I don't know why we are canonicalizing the property name - should just
g_return_if_fail() if not canonical, or warn as you say.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]