qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda Conditions to normal
Date: Fri, 29 Jul 2016 10:07:11 +0800	[thread overview]
Message-ID: <579ABA4F.7040907@cn.fujitsu.com> (raw)
In-Reply-To: <579A2571.9060101@redhat.com>



On 07/28/2016 11:32 PM, Eric Blake wrote:
> On 07/28/2016 04:50 AM, Cao jin wrote:
>> Follow CODING_STYLE
>>
>> Cc: Daniel P. Berrange <berrange@redhat.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   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) {
>

I prefer this style too, save seconds to think what's the value of 
assignment expression. Thanks for pointing it out:) v2 is coming.

> 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.
>

-- 
Yours Sincerely,

Cao jin

      reply	other threads:[~2016-07-29  2:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 10:50 [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda Conditions to normal Cao jin
2016-07-28 15:32 ` Eric Blake
2016-07-29  2:07   ` Cao jin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=579ABA4F.7040907@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).