persistent property store - first try
Kay Sievers
kay.sievers at vrfy.org
Fri Jun 11 11:37:57 PDT 2004
On Fri, 2004-06-11 at 13:44 -0400, Joe Shaw wrote:
> Hi,
>
> On Fri, 2004-06-11 at 17:21 +0200, Kay Sievers wrote:
> > Hmm, should we convert:
> > hal_device_property_set_persistence(d, "info.test", TRUE)
> >
> > to a generic method, so we may use it for other possible attributes too?
> > Something like this:
> > hal_device_property_set_attribute(d, "info.test", HAL_PROP_ATTR_CALLOUT, FALSE)
> > hal_device_property_set_attribute(d, "info.test", HAL_PROP_ATTR_PERSISTENCE, TRUE)
> >
> > Or if we have bits only:
> > hal_device_property_set_attribute(d, "info.test", HAL_PROP_ATTR_CALLOUT |)
> > HAL_PROP_ATTR_PERSISTENCE)
>
> It's probably a good idea to add this at the same time, but I don't have
> a strong feeling about whether it should be two separate functions or a
> bitfield.
>
> > @@ -728,8 +735,10 @@
> >
> > prop = hal_device_property_find (device, key);
> >
> > - if (prop == NULL)
> > - return FALSE;
> > + g_return_val_if_fail (prop != NULL, FALSE);
> > +
> > + if (hal_property_get_persistence (prop))
> > + hal_pstore_delete_property (hald_get_pstore_sys (), device, prop);
> >
> > device->properties = g_slist_remove (device->properties, prop);
>
> I'm not totally sure this is the right thing. Generally
> g_return_if_fail() is used to check for programmer errors like passing
> in a NULL value or an object of a wrong class, etc. If things fail
> it'll print a nasty glib warning at runtime. It doesn't seem harmful to
> me if a key which doesn't exist is passed into the remove function.
Yeah, you are right. This is what I get for not reading the
documentation. I will fix it, when David is back.
Much thanks for your help,
Kay
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list