[Spice-devel] [PATCH spice-server] dcc: Use "base" as pipe item base field name
Frediano Ziglio
fziglio at redhat.com
Mon Jun 18 10:17:09 UTC 2018
Most of pipe items use this name for the base field.
This also allows to use SPICE_UPCAST macros instead of a long
SPICE_CONTAINEROF.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc-send.c | 3 +--
server/dcc.c | 4 ++--
server/dcc.h | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 211c69d7..862b0f55 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2432,8 +2432,7 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
break;
case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
- RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, RedSurfaceCreateItem,
- pipe_item);
+ RedSurfaceCreateItem *surface_create = SPICE_UPCAST(RedSurfaceCreateItem, pipe_item);
marshall_surface_create(rcc, m, &surface_create->surface_create);
break;
}
diff --git a/server/dcc.c b/server/dcc.c
index 15b65978..92e4aee9 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -202,7 +202,7 @@ static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
create->surface_create.flags = flags;
create->surface_create.format = format;
- red_pipe_item_init(&create->pipe_item, RED_PIPE_ITEM_TYPE_CREATE_SURFACE);
+ red_pipe_item_init(&create->base, RED_PIPE_ITEM_TYPE_CREATE_SURFACE);
return create;
}
@@ -313,7 +313,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
surface->context.height,
surface->context.format, flags);
dcc->priv->surface_client_created[surface_id] = TRUE;
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->base);
}
// adding the pipe item after pos. If pos == NULL, adding to head.
diff --git a/server/dcc.h b/server/dcc.h
index 16d60ed0..e0335da3 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -96,7 +96,7 @@ typedef struct FreeList {
#define DCC_TO_DC(dcc) ((DisplayChannel*)red_channel_client_get_channel((RedChannelClient*)dcc))
typedef struct RedSurfaceCreateItem {
- RedPipeItem pipe_item;
+ RedPipeItem base;
SpiceMsgSurfaceCreate surface_create;
} RedSurfaceCreateItem;
--
2.17.1
More information about the Spice-devel
mailing list