Re: [PATCH] Introduce SPICE_UPCAST macro

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

 



On Tue, May 24, 2016 at 10:52:59AM +0100, Frediano Ziglio wrote:
> This was proposed by Christophe as improvement over some typesafe
> patches.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/char-device.c         |  2 +-
>  server/cursor-channel.c      |  6 +++---
>  server/dcc-encoders.c        |  2 +-
>  server/dcc-send.c            | 14 +++++++-------
>  server/dcc.c                 |  2 +-
>  server/display-channel.c     |  4 ++--
>  server/display-channel.h     |  2 +-
>  server/image-cache.c         |  4 ++--
>  server/inputs-channel.c      |  6 +++---
>  server/main-channel-client.c | 22 +++++++++++-----------
>  server/pixmap-cache.c        |  2 +-
>  server/red-channel.c         |  4 ++--
>  server/red-common.h          |  4 ++++
>  server/red-record-qxl.c      |  2 +-
>  server/reds.c                |  2 +-
>  server/smartcard.c           |  6 +++---
>  server/spicevmc.c            |  6 +++---
>  server/stream.c              |  6 +++---
>  server/tree.h                |  6 +++---
>  19 files changed, 53 insertions(+), 49 deletions(-)
> 
> diff --git a/server/char-device.c b/server/char-device.c
> index 4a6e4c8..cb35aa2 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -1002,7 +1002,7 @@ SpiceServer* red_char_device_get_server(RedCharDevice *dev)
>  
>  SpiceCharDeviceInterface *spice_char_device_get_interface(SpiceCharDeviceInstance *instance)
>  {
> -   return SPICE_CONTAINEROF(instance->base.sif, SpiceCharDeviceInterface, base);
> +   return SPICE_UPCAST(SpiceCharDeviceInterface, instance->base.sif);
>  }
>  
>  
> diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> index 23a8cb8..2869b11 100644
> --- a/server/cursor-channel.c
> +++ b/server/cursor-channel.c
> @@ -208,7 +208,7 @@ static void cursor_pipe_item_free(RedPipeItem *base)
>  {
>      spice_return_if_fail(base);
>  
> -    RedCursorPipeItem *pipe_item = SPICE_CONTAINEROF(base, RedCursorPipeItem, base);
> +    RedCursorPipeItem *pipe_item = SPICE_UPCAST(RedCursorPipeItem, base);

Totally unrelated to this patch, and no need to send patches to change
this now, but in general, I think RedPipeItem *pipe_item; and
RedCursorPipeItem *cursor_item; are slightly more descriptive.

>  
>      spice_assert(!red_pipe_item_is_linked(&pipe_item->base));
>  
> @@ -318,13 +318,13 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
>  
>      switch (pipe_item->type) {
>      case RED_PIPE_ITEM_TYPE_CURSOR:
> -        cursor_marshall(rcc, m, SPICE_CONTAINEROF(pipe_item, RedCursorPipeItem, base));
> +        cursor_marshall(rcc, m, SPICE_UPCAST(RedCursorPipeItem, pipe_item));
>          break;
>      case RED_PIPE_ITEM_TYPE_INVAL_ONE:
>          red_marshall_inval(rcc, m, SPICE_CONTAINEROF(pipe_item, RedCacheItem, u.pipe_data));

I think this one could be changed too?


Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
assuming others are good with SPICE_UPCAST too.

Christophe

Attachment: signature.asc
Description: PGP signature

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