[Spice-devel] [PATCH 1/2] Change GList in GQueue

Christophe Fergeau cfergeau at redhat.com
Tue Sep 13 15:56:40 UTC 2016


Hey,

On Mon, Sep 12, 2016 at 04:32:02PM +0100, Frediano Ziglio wrote:
> This patch is intended to be merged into "RedChannelClient: store pipe
> items in a GList".
> 
> GQueue improve GList for pipe usage as tail inserting/removal/access
> are O(1) instead of O(n).
> Also getting the number of items is O(1) instead of O(n).
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/dcc-send.c                   | 12 ++++----
>  server/dcc.c                        |  2 +-
>  server/display-channel.c            |  5 +---
>  server/red-channel-client-private.h |  2 +-
>  server/red-channel-client.c         | 58 +++++++++++++++++--------------------
>  server/red-channel-client.h         |  2 +-
>  6 files changed, 36 insertions(+), 45 deletions(-)
> 
> diff --git a/server/display-channel.c b/server/display-channel.c
> index bd2907f..de25161 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -331,10 +331,7 @@ static void drawable_remove_from_pipes(Drawable *drawable)
>  
>          dpi = SPICE_UPCAST(RedDrawablePipeItem, item);
>          rcc = RED_CHANNEL_CLIENT(dpi->dcc);
> -        if (red_channel_client_pipe_item_is_linked(rcc, &dpi->dpi_pipe_item)) {
> -            red_channel_client_pipe_remove_and_release(rcc,
> -                                                       &dpi->dpi_pipe_item);
> -        }
> +        red_channel_client_pipe_remove_and_release(rcc, &dpi->dpi_pipe_item);

I'd keep the red_channel_client_pipe_item_is_linked() here, this
probably belongs to a follow-up patch?

>      }
>  }
>  
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index 9f678d7..89ab679 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -1626,8 +1619,9 @@ gboolean red_channel_client_no_item_being_sent(RedChannelClient *rcc)
>  void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc,
>                                                  RedPipeItem *item)
>  {
> -    red_channel_client_pipe_remove(rcc, item);
> -    red_pipe_item_unref(item);
> +    if (red_channel_client_pipe_remove(rcc, item)) {
> +        red_pipe_item_unref(item);
> +    }

Is this changing behaviour compared to what was done before?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160913/d6a8755c/attachment.sig>


More information about the Spice-devel mailing list