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

Eric Blake eblake at redhat.com
Tue Aug 14 21:53:19 UTC 2012


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;
error:
    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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120814/f658da89/attachment-0001.sig>


More information about the libvir-list mailing list