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

Re: [libvirt] [PATCHv2 6/9] conf: make error returns from virDomainActualNetDefFormat consistent

On 08/14/2012 01:04 AM, Laine Stump wrote:
> There was an error: label that simply did "return ret", but ret was
> defaulted to -1, and was never used other than setting it manually to
> 0 just before a non-error return. Aside from this, some of the error
> return paths used "goto error" and others used "return ret".
> This patch removes ret and the error: label, and makes all error
> returns just consistently do "return -1".
> ---

> -
> -    ret = 0;
> -error:
> -    return ret;
> +    return 0;
>  }

And this style doesn't fall foul of my comments on the earlier patch
that was doing:

    ret = 0;
    return ret;

I was explaining to Laine on IRC that anywhere I see an 'error:' label,
I expect it to only be hit on error paths, my complaint on the other
patch wasn't about the label name being bad, but the fact that we had a
success case fall through to the error label.  Removing the error label
altogether works too :)

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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