qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda Conditions to no


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda Conditions to normal
Date: Thu, 28 Jul 2016 09:32:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 07/28/2016 04:50 AM, Cao jin wrote:
> Follow CODING_STYLE
> 
> Cc: Daniel P. Berrange <address@hidden>
> Cc: Gerd Hoffmann <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> 
> Signed-off-by: Cao jin <address@hidden>
> ---
>  util/qemu-sockets.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> Daniel P. Berrange make me realized there is Yoda Conditions in this file,
> this file is mixed with both style, since I just touched this file, so,
> reverting it is handy to me.
> 
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index 5e08723..a07acc5 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -386,7 +386,7 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
>          goto err;
>      }
>  
> -    if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) {
> +    if ((rc = getaddrinfo(addr, port, &ai, &peer)) != 0) {

CODING_STYLE is currently silent on whether assignment in conditionals
is appropriate, so maybe that should be patched.  But most of our code
prefers:

rc = getaddrinfo();
if (rc != 0) {

rather than assignments in the conditional.  I don't have any strong
opinions on whether that would require a respin or whether your patch is
fine as is.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]