Il 25/05/2012 18:05, Andreas Färber ha scritto:
>> > @@ -698,10 +702,8 @@ void object_property_del(Object *obj, const char 
>> > *name, Error **errp)
>> >  void object_property_get(Object *obj, Visitor *v, const char *name,
>> >                           Error **errp)
>> >  {
>> > -    ObjectProperty *prop = object_property_find(obj, name);
>> > -
>> > +    ObjectProperty *prop = object_property_find(obj, name, errp);
>> >      if (prop == NULL) {
>> > -        error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name);
>> >          return;
>> >      }
>> >  
> Currently it doesn't happen, but I wonder if we should check
> error_is_set(errp) instead of or in addition to prop == NULL now?
> Applies to all callsites above and below.

No, because errp can be NULL.  The rules are:

- if errors are also signaled by the return value, check the return value;

- otherwise, use a local variable and error_propagate.  You can test the
local variable against NULL directly, error_is_set is only needed if you
have an Error **.

In fact, using error_is_set is almost always wrong and we could probably
kill it.

Paolo

Reply via email to