[Spice-commits] 2 commits - server/dcc-encoders.c server/dcc-encoders.h server/dcc-send.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Jun 9 05:57:23 UTC 2016


 server/dcc-encoders.c |   20 --------------------
 server/dcc-encoders.h |   10 +++++-----
 server/dcc-send.c     |   20 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 2d34002e59b72f54973ed8da1f33ed3e4df833a3
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Jun 3 16:38:42 2016 +0100

    Move marshalling code from dcc-encoders to dcc-send
    
    No reasons why dcc-encoders should know about marshalling.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 5570798..a657887 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -429,26 +429,6 @@ void dcc_encoders_free(DisplayChannelClient *dcc)
     dcc->zlib = NULL;
 }
 
-static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
-{
-    g_free(opaque);
-}
-
-void marshaller_add_compressed(SpiceMarshaller *m,
-                               RedCompressBuf *comp_buf, size_t size)
-{
-    size_t max = size;
-    size_t now;
-    do {
-        spice_return_if_fail(comp_buf);
-        now = MIN(sizeof(comp_buf->buf), max);
-        max -= now;
-        spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
-                                      marshaller_compress_buf_free, comp_buf);
-        comp_buf = comp_buf->send_next;
-    } while (max);
-}
-
 /* Remove from the to_free list and the instances_list.
    When no instance is left - the RedGlzDrawable is released too. (and the qxl drawable too, if
    it is not used by Drawable).
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 88351dc..8c3f22f 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -19,7 +19,6 @@
 #define DCC_ENCODERS_H_
 
 #include <setjmp.h>
-#include <common/marshaller.h>
 #include <common/quic.h>
 
 #include "red-channel.h"
@@ -46,10 +45,6 @@ void             dcc_free_glz_drawables_to_free              (DisplayChannelClie
 void             dcc_freeze_glz                              (DisplayChannelClient *dcc);
 void             dcc_release_glz                             (DisplayChannelClient *dcc);
 
-void             marshaller_add_compressed                   (SpiceMarshaller *m,
-                                                              RedCompressBuf *comp_buf,
-                                                              size_t size);
-
 #define RED_COMPRESS_BUF_SIZE (1024 * 64)
 struct RedCompressBuf {
     /* This buffer provide space for compression algorithms.
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 5171f9a..6c10565 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -335,6 +335,26 @@ static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
     spice_marshall_DisplayBase(base_marshaller, &base);
 }
 
+static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
+{
+    compress_buf_free(opaque);
+}
+
+static void marshaller_add_compressed(SpiceMarshaller *m,
+                                      RedCompressBuf *comp_buf, size_t size)
+{
+    size_t max = size;
+    size_t now;
+    do {
+        spice_return_if_fail(comp_buf);
+        now = MIN(sizeof(comp_buf->buf), max);
+        max -= now;
+        spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
+                                      marshaller_compress_buf_free, comp_buf);
+        comp_buf = comp_buf->send_next;
+    } while (max);
+}
+
 /* if the number of times fill_bits can be called per one qxl_drawable increases -
    MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
 static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
commit fa4eb13f7b850144595bc9462f7629a4fafe876d
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Jun 3 16:22:08 2016 +0100

    Add compress_buf_free function
    
    dcc-encoders should be in change of allocate and free the structure
    don't put internal assumptions (which functions are used for memory
    management) in different files.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 0d3e96a..88351dc 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -63,6 +63,11 @@ struct RedCompressBuf {
     RedCompressBuf *send_next;
 };
 
+static inline void compress_buf_free(RedCompressBuf *buf)
+{
+    g_free(buf);
+}
+
 typedef struct GlzSharedDictionary {
     RingItem base;
     GlzEncDictContext *dict;


More information about the Spice-commits mailing list