[Spice-devel] [spice-server v2 14/14] rcc: Consistently name RedChannelClient 'rcc'

Christophe Fergeau cfergeau at redhat.com
Tue Feb 14 14:17:39 UTC 2017


It was sometimes named self, sometimes rcc, use rcc everywhere.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 server/red-channel-client.c | 138 ++++++++++++++++++++++----------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 393bada..9cf2550 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -248,35 +248,35 @@ red_channel_client_get_property(GObject *object,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
-    RedChannelClient *self = RED_CHANNEL_CLIENT(object);
+    RedChannelClient *rcc = RED_CHANNEL_CLIENT(object);
 
     switch (property_id)
     {
         case PROP_STREAM:
-            g_value_set_pointer(value, self->priv->stream);
+            g_value_set_pointer(value, rcc->priv->stream);
             break;
         case PROP_CHANNEL:
-            g_value_set_object(value, self->priv->channel);
+            g_value_set_object(value, rcc->priv->channel);
             break;
         case PROP_CLIENT:
-            g_value_set_object(value, self->priv->client);
+            g_value_set_object(value, rcc->priv->client);
             break;
         case PROP_MONITOR_LATENCY:
-            g_value_set_boolean(value, self->priv->monitor_latency);
+            g_value_set_boolean(value, rcc->priv->monitor_latency);
             break;
         case PROP_COMMON_CAPS:
             {
                 GArray *arr = g_array_sized_new(FALSE, FALSE,
-                                                sizeof(*self->priv->remote_caps.common_caps),
-                                                self->priv->remote_caps.num_common_caps);
+                                                sizeof(*rcc->priv->remote_caps.common_caps),
+                                                rcc->priv->remote_caps.num_common_caps);
                 g_value_take_boxed(value, arr);
             }
             break;
         case PROP_CAPS:
             {
                 GArray *arr = g_array_sized_new(FALSE, FALSE,
-                                                sizeof(*self->priv->remote_caps.caps),
-                                                self->priv->remote_caps.num_caps);
+                                                sizeof(*rcc->priv->remote_caps.caps),
+                                                rcc->priv->remote_caps.num_caps);
                 g_value_take_boxed(value, arr);
             }
             break;
@@ -291,31 +291,31 @@ red_channel_client_set_property(GObject *object,
                                 const GValue *value,
                                 GParamSpec *pspec)
 {
-    RedChannelClient *self = RED_CHANNEL_CLIENT(object);
+    RedChannelClient *rcc = RED_CHANNEL_CLIENT(object);
 
     switch (property_id)
     {
         case PROP_STREAM:
-            self->priv->stream = g_value_get_pointer(value);
+            rcc->priv->stream = g_value_get_pointer(value);
             break;
         case PROP_CHANNEL:
-            if (self->priv->channel)
-                g_object_unref(self->priv->channel);
-            self->priv->channel = g_value_dup_object(value);
+            if (rcc->priv->channel)
+                g_object_unref(rcc->priv->channel);
+            rcc->priv->channel = g_value_dup_object(value);
             break;
         case PROP_CLIENT:
-            self->priv->client = g_value_get_object(value);
+            rcc->priv->client = g_value_get_object(value);
             break;
         case PROP_MONITOR_LATENCY:
-            self->priv->monitor_latency = g_value_get_boolean(value);
+            rcc->priv->monitor_latency = g_value_get_boolean(value);
             break;
         case PROP_COMMON_CAPS:
             {
                 GArray *caps = g_value_get_boxed(value);
                 if (caps) {
-                    self->priv->remote_caps.num_common_caps = caps->len;
-                    free(self->priv->remote_caps.common_caps);
-                    self->priv->remote_caps.common_caps =
+                    rcc->priv->remote_caps.num_common_caps = caps->len;
+                    free(rcc->priv->remote_caps.common_caps);
+                    rcc->priv->remote_caps.common_caps =
                         spice_memdup(caps->data, caps->len * sizeof(uint32_t));
                 }
             }
@@ -324,9 +324,9 @@ red_channel_client_set_property(GObject *object,
             {
                 GArray *caps = g_value_get_boxed(value);
                 if (caps) {
-                    self->priv->remote_caps.num_caps = caps->len;
-                    free(self->priv->remote_caps.caps);
-                    self->priv->remote_caps.caps =
+                    rcc->priv->remote_caps.num_caps = caps->len;
+                    free(rcc->priv->remote_caps.caps);
+                    rcc->priv->remote_caps.caps =
                         spice_memdup(caps->data, caps->len * sizeof(uint32_t));
                 }
             }
@@ -339,22 +339,22 @@ red_channel_client_set_property(GObject *object,
 static void
 red_channel_client_finalize(GObject *object)
 {
-    RedChannelClient *self = RED_CHANNEL_CLIENT(object);
+    RedChannelClient *rcc = RED_CHANNEL_CLIENT(object);
 
-    reds_stream_free(self->priv->stream);
-    self->priv->stream = NULL;
+    reds_stream_free(rcc->priv->stream);
+    rcc->priv->stream = NULL;
 
-    if (self->priv->send_data.main.marshaller) {
-        spice_marshaller_destroy(self->priv->send_data.main.marshaller);
+    if (rcc->priv->send_data.main.marshaller) {
+        spice_marshaller_destroy(rcc->priv->send_data.main.marshaller);
     }
 
-    if (self->priv->send_data.urgent.marshaller) {
-        spice_marshaller_destroy(self->priv->send_data.urgent.marshaller);
+    if (rcc->priv->send_data.urgent.marshaller) {
+        spice_marshaller_destroy(rcc->priv->send_data.urgent.marshaller);
     }
 
-    red_channel_client_destroy_remote_caps(self);
-    if (self->priv->channel) {
-        g_object_unref(self->priv->channel);
+    red_channel_client_destroy_remote_caps(rcc);
+    if (rcc->priv->channel) {
+        g_object_unref(rcc->priv->channel);
     }
 
     G_OBJECT_CLASS(red_channel_client_parent_class)->finalize(object);
@@ -371,21 +371,21 @@ static void red_channel_client_default_disconnect(RedChannelClient *rcc);
 
 static void red_channel_client_constructed(GObject *object)
 {
-    RedChannelClient *self =  RED_CHANNEL_CLIENT(object);
+    RedChannelClient *rcc =  RED_CHANNEL_CLIENT(object);
 
-    self->priv->outgoing.pos = 0;
-    self->priv->outgoing.size = 0;
+    rcc->priv->outgoing.pos = 0;
+    rcc->priv->outgoing.size = 0;
 
-    if (red_channel_client_test_remote_common_cap(self, SPICE_COMMON_CAP_MINI_HEADER)) {
-        self->priv->incoming.header = mini_header_wrapper;
-        self->priv->send_data.header = mini_header_wrapper;
-        self->priv->is_mini_header = TRUE;
+    if (red_channel_client_test_remote_common_cap(rcc, SPICE_COMMON_CAP_MINI_HEADER)) {
+        rcc->priv->incoming.header = mini_header_wrapper;
+        rcc->priv->send_data.header = mini_header_wrapper;
+        rcc->priv->is_mini_header = TRUE;
     } else {
-        self->priv->incoming.header = full_header_wrapper;
-        self->priv->send_data.header = full_header_wrapper;
-        self->priv->is_mini_header = FALSE;
+        rcc->priv->incoming.header = full_header_wrapper;
+        rcc->priv->send_data.header = full_header_wrapper;
+        rcc->priv->is_mini_header = FALSE;
     }
-    self->priv->incoming.header.data = self->priv->incoming.header_buf;
+    rcc->priv->incoming.header.data = rcc->priv->incoming.header_buf;
 }
 
 static void red_channel_client_class_init(RedChannelClientClass *klass)
@@ -453,19 +453,19 @@ static void red_channel_client_class_init(RedChannelClientClass *klass)
 }
 
 static void
-red_channel_client_init(RedChannelClient *self)
+red_channel_client_init(RedChannelClient *rcc)
 {
-    self->priv = CHANNEL_CLIENT_PRIVATE(self);
+    rcc->priv = CHANNEL_CLIENT_PRIVATE(rcc);
     // blocks send message (maybe use send_data.blocked + block flags)
-    self->priv->ack_data.messages_window = ~0;
-    self->priv->ack_data.client_generation = ~0;
-    self->priv->ack_data.client_window = CLIENT_ACK_WINDOW;
-    self->priv->send_data.main.marshaller = spice_marshaller_new();
-    self->priv->send_data.urgent.marshaller = spice_marshaller_new();
+    rcc->priv->ack_data.messages_window = ~0;
+    rcc->priv->ack_data.client_generation = ~0;
+    rcc->priv->ack_data.client_window = CLIENT_ACK_WINDOW;
+    rcc->priv->send_data.main.marshaller = spice_marshaller_new();
+    rcc->priv->send_data.urgent.marshaller = spice_marshaller_new();
 
-    self->priv->send_data.marshaller = self->priv->send_data.main.marshaller;
+    rcc->priv->send_data.marshaller = rcc->priv->send_data.main.marshaller;
 
-    g_queue_init(&self->priv->pipe);
+    g_queue_init(&rcc->priv->pipe);
 }
 
 RedChannel* red_channel_client_get_channel(RedChannelClient *rcc)
@@ -952,9 +952,9 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
 {
     GError *local_error = NULL;
     SpiceCoreInterfaceInternal *core;
-    RedChannelClient *self = RED_CHANNEL_CLIENT(initable);
+    RedChannelClient *rcc = RED_CHANNEL_CLIENT(initable);
 
-    if (!red_channel_config_socket(self->priv->channel, self)) {
+    if (!red_channel_config_socket(rcc->priv->channel, rcc)) {
         g_set_error_literal(&local_error,
                             SPICE_SERVER_ERROR,
                             SPICE_SERVER_ERROR_FAILED,
@@ -962,29 +962,29 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
         goto cleanup;
     }
 
-    core = red_channel_get_core_interface(self->priv->channel);
-    if (self->priv->stream)
-        self->priv->stream->watch =
-            core->watch_add(core, self->priv->stream->socket,
+    core = red_channel_get_core_interface(rcc->priv->channel);
+    if (rcc->priv->stream)
+        rcc->priv->stream->watch =
+            core->watch_add(core, rcc->priv->stream->socket,
                             SPICE_WATCH_EVENT_READ,
                             red_channel_client_event,
-                            self);
+                            rcc);
 
-    if (self->priv->monitor_latency
-        && reds_stream_get_family(self->priv->stream) != AF_UNIX) {
-        self->priv->latency_monitor.timer =
-            core->timer_add(core, red_channel_client_ping_timer, self);
+    if (rcc->priv->monitor_latency
+        && reds_stream_get_family(rcc->priv->stream) != AF_UNIX) {
+        rcc->priv->latency_monitor.timer =
+            core->timer_add(core, red_channel_client_ping_timer, rcc);
 
-        if (!red_client_during_migrate_at_target(self->priv->client)) {
-            red_channel_client_start_ping_timer(self,
+        if (!red_client_during_migrate_at_target(rcc->priv->client)) {
+            red_channel_client_start_ping_timer(rcc,
                                                 PING_TEST_IDLE_NET_TIMEOUT_MS);
         }
-        self->priv->latency_monitor.roundtrip = -1;
+        rcc->priv->latency_monitor.roundtrip = -1;
     }
 
-    red_channel_add_client(self->priv->channel, self);
-    if (!red_client_add_channel(self->priv->client, self, &local_error)) {
-        red_channel_remove_client(self->priv->channel, self);
+    red_channel_add_client(rcc->priv->channel, rcc);
+    if (!red_client_add_channel(rcc->priv->client, rcc, &local_error)) {
+        red_channel_remove_client(rcc->priv->channel, rcc);
     }
 
 cleanup:
-- 
2.9.3



More information about the Spice-devel mailing list