From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Daniel P . Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PATCH 5/5] vnc: No need for Error** parameter at vnc_client_io_error()
Date: Thu, 8 Jun 2017 10:39:06 -0300 [thread overview]
Message-ID: <20170608133906.12737-6-ehabkost@redhat.com> (raw)
In-Reply-To: <20170608133906.12737-1-ehabkost@redhat.com>
The only callers of vnc_client_io_error() with non-NULL errp don't use
*errp after the function gets called, so there's no need to use an
Error** argument. Change parameter to Error* and simplify the code.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
ui/vnc.h | 2 +-
ui/vnc.c | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/ui/vnc.h b/ui/vnc.h
index 694cf32ca9..52f65bbd86 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -526,7 +526,7 @@ uint32_t read_u32(uint8_t *data, size_t offset);
/* Protocol stage functions */
void vnc_client_error(VncState *vs);
-ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp);
+ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error *err);
void start_client_init(VncState *vs);
void start_auth_vnc(VncState *vs);
diff --git a/ui/vnc.c b/ui/vnc.c
index 47b49c7318..51f13f0c29 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1180,7 +1180,7 @@ void vnc_disconnect_finish(VncState *vs)
g_free(vs);
}
-ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp)
+ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error *err)
{
if (ret <= 0) {
if (ret == 0) {
@@ -1188,14 +1188,11 @@ ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp)
vnc_disconnect_start(vs);
} else if (ret != QIO_CHANNEL_ERR_BLOCK) {
VNC_DEBUG("Closing down client sock: ret %zd (%s)\n",
- ret, errp ? error_get_pretty(*errp) : "Unknown");
+ ret, err ? error_get_pretty(err) : "Unknown");
vnc_disconnect_start(vs);
}
- if (errp) {
- error_free(*errp);
- *errp = NULL;
- }
+ error_free(err);
return 0;
}
return ret;
@@ -1231,7 +1228,7 @@ ssize_t vnc_client_write_buf(VncState *vs, const uint8_t *data, size_t datalen)
ret = qio_channel_write(
vs->ioc, (const char *)data, datalen, &err);
VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret);
- return vnc_client_io_error(vs, ret, &err);
+ return vnc_client_io_error(vs, ret, err);
}
@@ -1344,7 +1341,7 @@ ssize_t vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
ret = qio_channel_read(
vs->ioc, (char *)data, datalen, &err);
VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
- return vnc_client_io_error(vs, ret, &err);
+ return vnc_client_io_error(vs, ret, err);
}
--
2.11.0.259.g40922b1
next prev parent reply other threads:[~2017-06-08 13:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 13:39 [Qemu-devel] [PATCH 0/5] Error handling cleanup and fixes Eduardo Habkost
2017-06-08 13:39 ` [Qemu-devel] [PATCH 1/5] xilinx: Fix error handling Eduardo Habkost
2017-06-08 16:29 ` Alistair Francis
2017-07-05 11:44 ` Markus Armbruster
2017-07-06 14:08 ` Eduardo Habkost
2017-07-06 14:45 ` Markus Armbruster
2017-06-08 13:39 ` [Qemu-devel] [PATCH 2/5] block: Don't try to set *errp directly Eduardo Habkost
2017-06-08 15:04 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2017-07-05 11:50 ` [Qemu-devel] " Markus Armbruster
2017-06-08 13:39 ` [Qemu-devel] [PATCH 3/5] websock: " Eduardo Habkost
2017-06-08 15:46 ` Manos Pitsidianakis
2017-07-05 11:53 ` Markus Armbruster
2017-06-08 13:39 ` [Qemu-devel] [PATCH 4/5] migration: " Eduardo Habkost
2017-06-08 14:18 ` Juan Quintela
2017-06-08 14:21 ` Dr. David Alan Gilbert
2017-06-08 14:22 ` Dr. David Alan Gilbert
2017-06-08 13:39 ` Eduardo Habkost [this message]
2017-06-08 15:17 ` [Qemu-devel] [PATCH 5/5] vnc: No need for Error** parameter at vnc_client_io_error() Eric Blake
2017-06-08 16:05 ` Eduardo Habkost
2017-06-08 17:44 ` Eduardo Habkost
2017-06-08 21:22 ` Eric Blake
2017-06-08 15:18 ` [Qemu-devel] [PATCH 0/5] Error handling cleanup and fixes Eric Blake
2017-07-05 11:56 ` Markus Armbruster
2017-07-06 15:10 ` Markus Armbruster
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=20170608133906.12737-6-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@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).