From: Victor Toso <me@xxxxxxxxxxxxxx> To help avoid stream.c and dcc.c to access display-channel private structure to get the nth Stream structure pointer. Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> --- server/dcc.c | 2 +- server/display-channel.c | 5 +++++ server/display-channel.h | 1 + server/stream.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/dcc.c b/server/dcc.c index f8393362..a9529fae 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -487,7 +487,7 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc) for (i = 0; i < NUM_STREAMS; i++) { StreamAgent *agent = &dcc->priv->stream_agents[i]; - agent->stream = &display->priv->streams_buf[i]; + agent->stream = display_channel_get_nth_stream(display, i); region_init(&agent->vis_region); region_init(&agent->clip); } diff --git a/server/display-channel.c b/server/display-channel.c index bebee3bb..68ea3bad 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -2416,6 +2416,11 @@ int display_channel_get_stream_id(DisplayChannel *display, Stream *stream) return (int)(stream - display->priv->streams_buf); } +Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i) +{ + return &display->priv->streams_buf[i]; +} + gboolean display_channel_validate_surface(DisplayChannel *display, uint32_t surface_id) { if SPICE_UNLIKELY(surface_id >= display->priv->n_surfaces) { diff --git a/server/display-channel.h b/server/display-channel.h index 436cd33e..d15aad46 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -184,6 +184,7 @@ typedef struct RedSurface { _iter, DisplayChannelClient, _data) int display_channel_get_stream_id(DisplayChannel *display, Stream *stream); +Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i); typedef struct RedSurfaceDestroyItem { RedPipeItem pipe_item; diff --git a/server/stream.c b/server/stream.c index 9a3a82d1..ff2676cf 100644 --- a/server/stream.c +++ b/server/stream.c @@ -141,7 +141,7 @@ void display_channel_init_streams(DisplayChannel *display) ring_init(&display->priv->streams); display->priv->free_streams = NULL; for (i = 0; i < NUM_STREAMS; i++) { - Stream *stream = &display->priv->streams_buf[i]; + Stream *stream = display_channel_get_nth_stream(display, i); ring_item_init(&stream->link); stream_free(display, stream); } -- 2.13.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel