Re: [PATCH 3.2/12] Make cursor_channel_disconnect a CursorChannel method

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

 



On Thu, Oct 29, 2015 at 04:54:39PM -0500, Jonathon Jongsma wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
> 
> The first argument should be CursorChannel* rather than RedChannel*
> since it's essentially a CursorChannel method.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  server/cursor-channel.c | 4 +++-
>  server/cursor-channel.h | 2 +-
>  server/red_worker.c     | 2 +-
>  3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> index 2d7afc6..219c1da 100644
> --- a/server/cursor-channel.c
> +++ b/server/cursor-channel.c
> @@ -138,8 +138,10 @@ static void red_reset_cursor_cache(RedChannelClient *rcc)
>      red_cursor_cache_reset(RCC_TO_CCC(rcc), CLIENT_CURSOR_CACHE_SIZE);
>  }
>  
> -void cursor_channel_disconnect(RedChannel *channel)
> +void cursor_channel_disconnect(CursorChannel *cursor)
>  {
> +    RedChannel *channel = (RedChannel *)cursor;
> +
>      if (!channel || !red_channel_is_connected(channel)) {
>          return;
>      }
> diff --git a/server/cursor-channel.h b/server/cursor-channel.h
> index 8b49df7..c7eee81 100644
> --- a/server/cursor-channel.h
> +++ b/server/cursor-channel.h
> @@ -79,7 +79,7 @@ typedef struct CursorChannel {
>  G_STATIC_ASSERT(sizeof(CursorItem) <= QXL_CURSUR_DEVICE_DATA_SIZE);
>  
>  CursorChannel*       cursor_channel_new         (RedWorker *worker, int migrate);
> -void                 cursor_channel_disconnect  (RedChannel *channel);
> +void                 cursor_channel_disconnect  (CursorChannel *cursor);
>  void                 cursor_channel_reset       (CursorChannel *cursor);
>  void                 cursor_channel_process_cmd (CursorChannel *cursor, RedCursorCmd *cursor_cmd,
>                                                   uint32_t group_id);
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 96c0f14..2543713 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -8908,7 +8908,7 @@ static inline void flush_cursor_commands(RedWorker *worker)
>              red_channel_send(channel);
>              if (red_now() >= end_time) {
>                  spice_warning("flush cursor timeout");
> -                cursor_channel_disconnect(channel);
> +                cursor_channel_disconnect(worker->cursor_channel);
>                  worker->cursor_channel = NULL;
>              } else {
>                  sleep_count++;

Fwiw, this method has 'channel', 'cursor_red_channel' (both are
RedChannel *) and it also references 'worker->cursor_channel' as a
CursorChannel. Ultimately these 3 variables are referencing to the same
memory location, would be less messy to have 2 (one RedChannel, one
CursorChannel) defined together, or not to have any and to use
worker->cursor_channel + cast if needed everywhere.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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]