On Wed, 27 Nov 2013 21:58:18 -0700
Eric Blake <ebl...@redhat.com> wrote:

> On 11/27/2013 06:24 PM, Igor Mammedov wrote:
> > in case if caller setting property doesn't care about error and
> > passes in NULL as errp argument but error occurs in property setter,
> > it is silently discarded leaving object in undefined state.
> > 
> > As result it leads to hard to find bugs, so if caller doesn't
> > care about error it must be sure that property exists and
> > accepts provided value, otherwise it's better to abort early
> > since error case couldn't be handled gracefully and find
> > invalid usecase early.
> > 
> > In addition multitude of property setters will be always
> > guarantied to have error object present and won't be required
> 
> s/guarantied/guaranteed/
thanks, I'll fix it.

> 
> > to handle this condition individually.
> > 
> > Signed-off-by: Igor Mammedov <imamm...@redhat.com>
> > ---
> 
> > +out:
> > +    if (local_error) {
> 
> This says local_error was set...
> 
> > +        if (!errp) {
> > +            assert_no_error(local_error);
> 
> so this assert_no_error() is dead code in its current position.  To be
> useful, you probably want:
it is not, retested it again and it still fails when errp == NULL but
there is a error in local_error.

> 
> if (!errp) {
>     assert_no_error(local_error);
> } else if (local_error) {
>     error_propagate(errp, local_error);
> }
this's just another way to do the same thing.


Reply via email to