From: Eric Blake <eblake@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.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: Thu, 28 Jul 2016 09:32:01 -0600 [thread overview]
Message-ID: <579A2571.9060101@redhat.com> (raw)
In-Reply-To: <1469703004-14800-1-git-send-email-caoj.fnst@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]
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) {
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-07-28 15:32 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 [this message]
2016-07-29 2:07 ` Cao jin
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=579A2571.9060101@redhat.com \
--to=eblake@redhat.com \
--cc=caoj.fnst@cn.fujitsu.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).