[Spice-devel] [PATCH spice-server 21/30] Minor optimization
Frediano Ziglio
fziglio at redhat.com
Mon Nov 21 12:52:08 UTC 2016
Save some bits.
---
server/websocket.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/server/websocket.c b/server/websocket.c
index f5b3aaa..99d7fb4 100644
--- a/server/websocket.c
+++ b/server/websocket.c
@@ -57,11 +57,11 @@
#define WEBSOCKET_MAX_HEADER_SIZE (1 + 9 + 4)
typedef struct {
- int type;
- int masked;
+ guint8 type;
guint8 header[WEBSOCKET_MAX_HEADER_SIZE];
int header_pos;
- int frame_ready:1;
+ gboolean frame_ready:1;
+ gboolean masked:1;
guint8 mask[4];
guint64 relayed;
guint64 expected_len;
@@ -211,7 +211,7 @@ static void websocket_get_frame_header(websocket_frame_t *frame)
frame->type = frame->header[0] & TYPE_MASK;
used++;
- frame->masked = frame->header[1] & MASK_FLAG;
+ frame->masked = !!(frame->header[1] & MASK_FLAG);
/* This is a Spice specific optimization. We don't really
care about assembling frames fully, so we treat
@@ -227,7 +227,7 @@ static void websocket_get_frame_header(websocket_frame_t *frame)
}
frame->relayed = 0;
- frame->frame_ready = 1;
+ frame->frame_ready = TRUE;
}
static int relay_data(guint8* buf, size_t size, websocket_frame_t *frame)
--
2.7.4
More information about the Spice-devel
mailing list