[Spice-devel] [PATCH 3/3] Simplify setting char device instance

Frediano Ziglio fziglio at redhat.com
Tue May 31 09:53:12 UTC 2016


Setting "sin" property is equivalent to call
red_char_device_reset_dev_instance so there is no need for a if/else
as the code is doing mostly (beside setting agent_attached) the
same thing

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 9367a6d..e4d806c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3093,12 +3093,8 @@ static RedCharDevice *attach_to_red_agent(RedsState *reds, SpiceCharDeviceInstan
     RedCharDeviceVDIPort *dev = reds->agent_dev;
     SpiceCharDeviceInterface *sif;
 
-    if (dev->priv->agent_attached) {
-        red_char_device_reset_dev_instance(RED_CHAR_DEVICE(dev), sin);
-    } else {
-        dev->priv->agent_attached = TRUE;
-        g_object_set(G_OBJECT(dev), "sin", sin, NULL);
-    }
+    dev->priv->agent_attached = TRUE;
+    red_char_device_reset_dev_instance(RED_CHAR_DEVICE(dev), sin);
 
     reds->vdagent = sin;
     reds_update_mouse_mode(reds);
-- 
2.7.4



More information about the Spice-devel mailing list