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

Jonathon Jongsma jjongsma at redhat.com
Wed Jun 1 15:13:13 UTC 2016


Looks fine

Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

On Tue, 2016-05-31 at 10:53 +0100, Frediano Ziglio wrote:
> 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);


More information about the Spice-devel mailing list