[libsoup] websockets: minor optimization



commit 18b7d1b62e42440965d69ccba3a6e1aa241a6f37
Author: Dan Winship <danw gnome org>
Date:   Tue Mar 3 10:55:12 2015 -0500

    websockets: minor optimization
    
    We always add a NUL byte to the end of received messages, but we were
    forcing a reallocation to happen in order to that. Fix that by
    creating the GByteArray at the right size initially.

 libsoup/soup-websocket-connection.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index d792637..67b47bc 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -628,7 +628,7 @@ process_contents (SoupWebsocketConnection *self,
 
                if (opcode) {
                        pv->message_opcode = opcode;
-                       pv->message_data = g_byte_array_sized_new (payload_len);
+                       pv->message_data = g_byte_array_sized_new (payload_len + 1);
                }
 
                switch (pv->message_opcode) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]