[Spice-devel] [spice-gtk v3 4/6] spice_channel_read_wire: move variables to internal scope

Victor Toso victortoso at redhat.com
Tue Feb 28 11:21:49 UTC 2017


From: Victor Toso <me at victortoso.com>

And avoid single line if plus comment

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-channel.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index f2d1b8a..c2e8a01 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1048,12 +1048,15 @@ static int spice_channel_read_wire_nonblocking(SpiceChannel *channel,
 static int spice_channel_read_wire(SpiceChannel *channel, void *data, size_t len)
 {
     SpiceChannelPrivate *c = channel->priv;
-    GIOCondition cond;
-    gssize ret;
 
     while (TRUE) {
+        gssize ret;
+        GIOCondition cond;
 
-        if (c->has_error) return 0; /* has_error is set by disconnect(), return no error */
+        if (c->has_error) {
+            /* has_error is set by disconnect(), return no error */
+            return 0;
+        }
 
         ret = spice_channel_read_wire_nonblocking(channel, data, len, &cond);
 
-- 
2.9.3



More information about the Spice-devel mailing list