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 <berra...@redhat.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>

Signed-off-by: Cao jin <caoj.f...@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 via email to