Re: [PATCH 4/4] Simplify spice_main_update_display_enabled()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

----- Original Message -----
> When id is -1, we disable or enable all displays. To simplify the logic,
> just call this function recursively in this case.
> ---
>  src/channel-main.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Is this really simplified?

> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 3b9d5b1..9383dbf 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -2784,15 +2784,16 @@ void
> spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboole
>      if (id == -1) {
>          gint i;
>          for (i = 0; i < G_N_ELEMENTS(c->display); i++) {
> -            c->display[i].display_state = display_state;
> -        }
> -    } else {
> -        g_return_if_fail(id < G_N_ELEMENTS(c->display));
> -        if (c->display[id].display_state == display_state)
> +            spice_main_update_display_enabled(channel, i, enabled, update);
>              return;
> -        c->display[id].display_state = display_state;
> +        }
>      }
>  
> +    g_return_if_fail(id < G_N_ELEMENTS(c->display));
> +    if (c->display[id].display_state == display_state)
> +        return;
> +    c->display[id].display_state = display_state;
> +
>      if (update)
>          update_display_timer(channel, 1);
>  }
> --
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]