[Spice-devel] [PATCH spice-server 05/30] Use len parameter directly

Frediano Ziglio fziglio at redhat.com
Mon Nov 21 12:51:52 UTC 2016


No reason to copy into another variable.
---
 server/websocket.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/server/websocket.c b/server/websocket.c
index 0f433f0..34a3448 100644
--- a/server/websocket.c
+++ b/server/websocket.c
@@ -268,7 +268,6 @@ int websocket_read(void *opaque, guchar *buf, int size, websocket_frame_t *frame
 
 static int fill_header(guint8 *header, guint64 len)
 {
-    guint64 shiftlen;
     int used = 0;
     int i;
 
@@ -277,12 +276,11 @@ static int fill_header(guint8 *header, guint64 len)
 
     header[1] = 0;
     used++;
-    shiftlen = len;
     if (len > 65535) {
         header[1] |= LENGTH_64BIT;
         for (i = 9; i >= 2; i--) {
-            header[i] = shiftlen & 0xFF;
-            shiftlen = shiftlen >> 8;
+            header[i] = len & 0xFF;
+            len >>= 8;
         }
         used += 8;
     }
-- 
2.7.4



More information about the Spice-devel mailing list