[Top][All Lists]

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda C

From: Cao jin
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] util/qemu-sockets: revert Yoda Conditions to normal
Date: Fri, 29 Jul 2016 10:07:11 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/28/2016 11:32 PM, Eric Blake wrote:
On 07/28/2016 04:50 AM, Cao jin wrote:

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

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 via email to

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