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

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

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]