Re: silent property name canonization



Joshua N Pritikin <vishnu pobox com> writes:
> On Thu, Aug 30, 2001 at 11:41:55AM -0400, Havoc Pennington wrote:
> > 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.
> > > 
> > 
> > Oh, I know why we probably do this - so that when we lookup prop names
> > we can unconditionally canonicalize the passed-in name and then
> > strcmp() with the pspec name.
> 
> Well, if you're indifferent, please apply my patch so that there actually
> is a strcmp in there.  ;-)
> 

What I mean is that if you g_object_set (obj, "foo-bar", 10, NULL), 
it is supposed to work with the "foo_bar" property.

Havoc




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