[Spice-commits] gtk/spice-channel.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Thu Nov 29 16:12:27 PST 2012


 gtk/spice-channel.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit d813df374f2ec847e63018a569cf9324ca83a999
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Nov 30 00:57:03 2012 +0100

    channel: make spice_msg_out_send() slightly easier to read
    
    Avoid the obfuscating many -> indirection by using the
    SpiceChannelPrivate *c variable.

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 500935a..06667d4 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -682,24 +682,26 @@ static gboolean spice_channel_idle_wakeup(gpointer user_data)
 G_GNUC_INTERNAL
 void spice_msg_out_send(SpiceMsgOut *out)
 {
+    SpiceChannelPrivate *c;
     gboolean was_empty;
 
     g_return_if_fail(out != NULL);
     g_return_if_fail(out->channel != NULL);
+    c = out->channel->priv;
 
-    STATIC_MUTEX_LOCK(out->channel->priv->xmit_queue_lock);
-    if (out->channel->priv->xmit_queue_blocked) {
+    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    if (c->xmit_queue_blocked) {
         g_warning("message queue is blocked, dropping message");
         goto end;
     }
 
-    was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue);
-    g_queue_push_tail(&out->channel->priv->xmit_queue, out);
+    was_empty = g_queue_is_empty(&c->xmit_queue);
+    g_queue_push_tail(&c->xmit_queue, out);
 
     /* One wakeup is enough to empty the entire queue -> only do a wakeup
        if the queue was empty, and there isn't one pending already. */
-    if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) {
-        out->channel->priv->xmit_queue_wakeup_id =
+    if (was_empty && !c->xmit_queue_wakeup_id) {
+        c->xmit_queue_wakeup_id =
             /* Use g_timeout_add_full so that can specify the priority */
             g_timeout_add_full(G_PRIORITY_HIGH, 0,
                                spice_channel_idle_wakeup,
@@ -707,7 +709,7 @@ void spice_msg_out_send(SpiceMsgOut *out)
     }
 
 end:
-    STATIC_MUTEX_UNLOCK(out->channel->priv->xmit_queue_lock);
+    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
 }
 
 /* coroutine context */


More information about the Spice-commits mailing list