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

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Sep 20 12:11:11 UTC 2016


 server/dcc-send.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 9481af181d59077433cf647cf8b8d109fb042772
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Sep 18 04:01:07 2016 +0100

    Simplify send_free_list
    
    The check for free_list->wait.header.wait_count was always true.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 32c6f17..c49adab 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -263,9 +263,9 @@ static void send_free_list(RedChannelClient *rcc)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     FreeList *free_list = &dcc->priv->send_data.free_list;
-    int sub_list_len = 1;
+    const int sub_list_len = 2;
     SpiceMarshaller *urgent_marshaller;
-    SpiceMarshaller *wait_m = NULL;
+    SpiceMarshaller *wait_m;
     SpiceMarshaller *inval_m;
     uint32_t sub_arr_offset;
     uint32_t wait_offset = 0;
@@ -292,14 +292,13 @@ static void send_free_list(RedChannelClient *rcc)
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_LIST, NULL);
 
+    /* append invalidate list */
     inval_m = spice_marshaller_get_submarshaller(urgent_marshaller);
     marshal_sub_msg_inval_list(inval_m, free_list);
 
-    if (free_list->wait.header.wait_count) {
-        wait_m = spice_marshaller_get_submarshaller(urgent_marshaller);
-        marshal_sub_msg_inval_list_wait(wait_m, free_list);
-        sub_list_len++;
-    }
+    /* append wait list */
+    wait_m = spice_marshaller_get_submarshaller(urgent_marshaller);
+    marshal_sub_msg_inval_list_wait(wait_m, free_list);
 
     sub_arr_offset = sub_list_len * sizeof(uint32_t);
 
@@ -308,10 +307,8 @@ static void send_free_list(RedChannelClient *rcc)
                                                          // adding the sub list
                                                          // offsets array to the marshaller
     /* adding the array of offsets */
-    if (wait_m) {
-        wait_offset = spice_marshaller_get_offset(wait_m);
-        spice_marshaller_add_uint32(urgent_marshaller, wait_offset + sub_arr_offset);
-    }
+    wait_offset = spice_marshaller_get_offset(wait_m);
+    spice_marshaller_add_uint32(urgent_marshaller, wait_offset + sub_arr_offset);
     spice_marshaller_add_uint32(urgent_marshaller, inval_offset + sub_arr_offset);
 }
 
commit eebc89b85b05bc286e89a41949ab6c1d47c29d17
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Sep 18 03:27:47 2016 +0100

    Revert if to make code more readable
    
    Keep all code to send SPICE_MSG_LIST together.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 1d05c68..32c6f17 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -283,14 +283,15 @@ static void send_free_list(RedChannelClient *rcc)
         dcc_pixmap_cache_hit(dcc, dcc->priv->send_data.pixmap_cache_items[i], &dummy);
     }
 
-    if (free_list->wait.header.wait_count) {
-        red_channel_client_init_send_data(rcc, SPICE_MSG_LIST, NULL);
-    } else { /* only one message, no need for a list */
+    if (!free_list->wait.header.wait_count) {
+        /* only one message, no need for a list */
         red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_LIST, NULL);
         spice_marshall_msg_display_inval_list(urgent_marshaller, free_list->res);
         return;
     }
 
+    red_channel_client_init_send_data(rcc, SPICE_MSG_LIST, NULL);
+
     inval_m = spice_marshaller_get_submarshaller(urgent_marshaller);
     marshal_sub_msg_inval_list(inval_m, free_list);
 


More information about the Spice-commits mailing list