Re: [spice-server 2/2] worker: Remove display_is_connected()

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

 



> 
> It's only called once, and when it's called, we will have dereferenced
> worker->display_channel a few lines before, so this cannot be NULL. The
> if (worker->display_channel) check can thus be removed, so
> display_is_connected() becomes just red_channel_is_connected().
> 
> Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> ---
>  server/red-worker.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 541110f83..8424306d9 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -93,12 +93,6 @@ struct RedWorker {
>      GMainLoop *loop;
>  };
>  
> -static int display_is_connected(RedWorker *worker)
> -{
> -    return worker->display_channel &&
> -        red_channel_is_connected(RED_CHANNEL(worker->display_channel));
> -}
> -
>  void red_drawable_unref(RedDrawable *red_drawable)
>  {
>      if (--red_drawable->refs) {
> @@ -529,7 +523,7 @@ static void dev_create_primary_surface(RedWorker *worker,
> uint32_t surface_id,
>  
>      CommonGraphicsChannel *common = COMMON_GRAPHICS_CHANNEL(display);
>      RedChannel *channel = RED_CHANNEL(display);
> -    if (display_is_connected(worker) &&
> +    if (red_channel_is_connected(channel) &&
>          !common_graphics_channel_get_during_target_migrate(common)) {
>          /* guest created primary, so it will (hopefully) send a
>          monitors_config
>           * now, don't send our own temporary one */

Ok, so you cannot move channel initialization inside the if.

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]