[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2] util/qemu-sockets: revert Yoda Conditions to nor
From: |
Cao jin |
Subject: |
[Qemu-devel] [PATCH v2] util/qemu-sockets: revert Yoda Conditions to normal |
Date: |
Fri, 29 Jul 2016 10:15:46 +0800 |
Follow CODING_STYLE
Cc: Daniel P. Berrange <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Eric Blake <address@hidden>
Signed-off-by: Cao jin <address@hidden>
---
util/qemu-sockets.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
v2 changelog:
1. fix to Eric's comments.
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 5e08723..2d48629 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -386,7 +386,8 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
goto err;
}
- if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) {
+ rc = getaddrinfo(addr, port, &ai, &peer);
+ if (rc != 0) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
gai_strerror(rc));
goto err;
@@ -412,7 +413,8 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
port = "0";
}
- if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) {
+ rc = getaddrinfo(addr, port, &ai, &local);
+ if (rc != 0) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
gai_strerror(rc));
goto err;
@@ -472,20 +474,20 @@ InetSocketAddress *inet_parse(const char *str, Error
**errp)
if (str[0] == ':') {
/* no host given */
host[0] = '\0';
- if (1 != sscanf(str, ":%32[^,]%n", port, &pos)) {
+ if (sscanf(str, ":%32[^,]%n", port, &pos) != 1) {
error_setg(errp, "error parsing port in address '%s'", str);
goto fail;
}
} else if (str[0] == '[') {
/* IPv6 addr */
- if (2 != sscanf(str, "[%64[^]]]:%32[^,]%n", host, port, &pos)) {
+ if (sscanf(str, "[%64[^]]]:%32[^,]%n", host, port, &pos) != 2) {
error_setg(errp, "error parsing IPv6 address '%s'", str);
goto fail;
}
addr->ipv6 = addr->has_ipv6 = true;
} else {
/* hostname or IPv4 addr */
- if (2 != sscanf(str, "%64[^:]:%32[^,]%n", host, port, &pos)) {
+ if (sscanf(str, "%64[^:]:%32[^,]%n", host, port, &pos) != 2) {
error_setg(errp, "error parsing address '%s'", str);
goto fail;
}
--
2.1.0
- [Qemu-devel] [PATCH v2] util/qemu-sockets: revert Yoda Conditions to normal,
Cao jin <=