[Spice-devel] [spice-server 01/10] Remove unused 3rd red_channel_register_client_cbs() arg
Frediano Ziglio
fziglio at redhat.com
Fri Feb 10 09:23:46 UTC 2017
>
> On Tue, 2017-02-07 at 11:59 +0100, Christophe Fergeau wrote:
> > It was probably meant to be used as a "user_data" argument for the
> > various callbacks, but turns out not to be used.
>
> Hmm, it looks like the last use of this 'data' variable was removed in
> 96e94c6f. That commit used g_object_set_data() to attach the
> 'dispatcher' object to the channel object rather than setting priv-
> >data via the _register_client_cbs() function. I'm not too fond of
> g_object_set_data() for that use (even though apparently I was the one
> that did it). I wonder if there's a better approach than either of
> these approaches... I'll try to review the rest of the patches in this
> series and come back to this...
>
> Jonathon
>
+1
Why not adding a data/opaque field to ClientCbs ?
Would remove the parameter (as this patch) but allows the dispatcher
(the only usage) to be stored and retrieved.
Frediano
>
> > ---
> > server/inputs-channel.c | 2 +-
> > server/main-channel.c | 2 +-
> > server/red-channel.c | 6 +-----
> > server/red-channel.h | 2 +-
> > server/red-worker.c | 4 ++--
> > server/smartcard.c | 2 +-
> > server/sound.c | 4 ++--
> > server/spicevmc.c | 2 +-
> > 8 files changed, 10 insertions(+), 14 deletions(-)
> >
> > diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> > index f105b4d..e197f68 100644
> > --- a/server/inputs-channel.c
> > +++ b/server/inputs-channel.c
> > @@ -608,7 +608,7 @@ inputs_channel_constructed(GObject *object)
> >
> > client_cbs.connect = inputs_connect;
> > client_cbs.migrate = inputs_migrate;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > NULL);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> >
> > red_channel_set_cap(RED_CHANNEL(self),
> > SPICE_INPUTS_CAP_KEY_SCANCODE);
> > reds_register_channel(reds, RED_CHANNEL(self));
> > diff --git a/server/main-channel.c b/server/main-channel.c
> > index 1124506..745f155 100644
> > --- a/server/main-channel.c
> > +++ b/server/main-channel.c
> > @@ -335,7 +335,7 @@ main_channel_constructed(GObject *object)
> > red_channel_set_cap(RED_CHANNEL(self),
> > SPICE_MAIN_CAP_SEAMLESS_MIGRATE);
> >
> > client_cbs.migrate = main_channel_client_migrate;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > NULL);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> > }
> >
> > static void
> > diff --git a/server/red-channel.c b/server/red-channel.c
> > index f2a35f3..835a744 100644
> > --- a/server/red-channel.c
> > +++ b/server/red-channel.c
> > @@ -91,8 +91,6 @@ struct RedChannelPrivate
> > RedChannelCapabilities local_caps;
> > uint32_t migration_flags;
> >
> > - void *data;
> > -
> > OutgoingHandlerInterface outgoing_cb;
> > IncomingHandlerInterface incoming_cb;
> >
> > @@ -428,8 +426,7 @@ StatNodeRef red_channel_get_stat_node(RedChannel
> > *channel)
> > return 0;
> > }
> >
> > -void red_channel_register_client_cbs(RedChannel *channel, const
> > ClientCbs *client_cbs,
> > - gpointer cbs_data)
> > +void red_channel_register_client_cbs(RedChannel *channel, const
> > ClientCbs *client_cbs)
> > {
> > spice_assert(client_cbs->connect || channel->priv->type ==
> > SPICE_CHANNEL_MAIN);
> > channel->priv->client_cbs.connect = client_cbs->connect;
> > @@ -441,7 +438,6 @@ void red_channel_register_client_cbs(RedChannel
> > *channel, const ClientCbs *clien
> > if (client_cbs->migrate) {
> > channel->priv->client_cbs.migrate = client_cbs->migrate;
> > }
> > - channel->priv->data = cbs_data;
> > }
> >
> > static void add_capability(uint32_t **caps, int *num_caps, uint32_t
> > cap)
> > diff --git a/server/red-channel.h b/server/red-channel.h
> > index f2866f5..7b6846f 100644
> > --- a/server/red-channel.h
> > +++ b/server/red-channel.h
> > @@ -209,7 +209,7 @@ void red_channel_remove_client(RedChannel
> > *channel, RedChannelClient *rcc);
> >
> > void red_channel_set_stat_node(RedChannel *channel, StatNodeRef
> > stat);
> >
> > -void red_channel_register_client_cbs(RedChannel *channel, const
> > ClientCbs *client_cbs, gpointer cbs_data);
> > +void red_channel_register_client_cbs(RedChannel *channel, const
> > ClientCbs *client_cbs);
> > // caps are freed when the channel is destroyed
> > void red_channel_set_common_cap(RedChannel *channel, uint32_t cap);
> > void red_channel_set_cap(RedChannel *channel, uint32_t cap);
> > diff --git a/server/red-worker.c b/server/red-worker.c
> > index 475acc4..230e87d 100644
> > --- a/server/red-worker.c
> > +++ b/server/red-worker.c
> > @@ -1372,7 +1372,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> > &worker->core);
> > channel = RED_CHANNEL(worker->cursor_channel);
> > red_channel_set_stat_node(channel, stat_add_node(reds, worker-
> > >stat, "cursor_channel", TRUE));
> > - red_channel_register_client_cbs(channel, client_cursor_cbs,
> > dispatcher);
> > + red_channel_register_client_cbs(channel, client_cursor_cbs);
> > g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
> > reds_register_channel(reds, channel);
> >
> > @@ -1383,7 +1383,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> > init_info.n_surfac
> > es);
> > channel = RED_CHANNEL(worker->display_channel);
> > red_channel_set_stat_node(channel, stat_add_node(reds, worker-
> > >stat, "display_channel", TRUE));
> > - red_channel_register_client_cbs(channel, client_display_cbs,
> > dispatcher);
> > + red_channel_register_client_cbs(channel, client_display_cbs);
> > g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
> > reds_register_channel(reds, channel);
> >
> > diff --git a/server/smartcard.c b/server/smartcard.c
> > index f4bc40d..bfc4b24 100644
> > --- a/server/smartcard.c
> > +++ b/server/smartcard.c
> > @@ -577,7 +577,7 @@ red_smartcard_channel_constructed(GObject
> > *object)
> > G_OBJECT_CLASS(red_smartcard_channel_parent_class)-
> > >constructed(object);
> >
> > client_cbs.connect = smartcard_connect_client;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > NULL);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> >
> > reds_register_channel(reds, RED_CHANNEL(self));
> > }
> > diff --git a/server/sound.c b/server/sound.c
> > index 7c36174..2692fe5 100644
> > --- a/server/sound.c
> > +++ b/server/sound.c
> > @@ -1393,7 +1393,7 @@ playback_channel_constructed(GObject *object)
> >
> > client_cbs.connect = snd_set_playback_peer;
> > client_cbs.migrate = snd_migrate_channel_client;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > self);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> >
> > if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1,
> > SND_CODEC_ANY_FREQUENCY)) {
> > red_channel_set_cap(RED_CHANNEL(self),
> > SPICE_PLAYBACK_CAP_CELT_0_5_1);
> > @@ -1443,7 +1443,7 @@ record_channel_constructed(GObject *object)
> >
> > client_cbs.connect = snd_set_record_peer;
> > client_cbs.migrate = snd_migrate_channel_client;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > self);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> >
> > if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1,
> > SND_CODEC_ANY_FREQUENCY)) {
> > red_channel_set_cap(RED_CHANNEL(self),
> > SPICE_RECORD_CAP_CELT_0_5_1);
> > diff --git a/server/spicevmc.c b/server/spicevmc.c
> > index 9bcbada..180d4eb 100644
> > --- a/server/spicevmc.c
> > +++ b/server/spicevmc.c
> > @@ -192,7 +192,7 @@ red_vmc_channel_constructed(GObject *object)
> > G_OBJECT_CLASS(red_vmc_channel_parent_class)-
> > >constructed(object);
> >
> > client_cbs.connect = spicevmc_connect;
> > - red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs,
> > NULL);
> > + red_channel_register_client_cbs(RED_CHANNEL(self), &client_cbs);
> >
> > #ifdef USE_LZ4
> > red_channel_set_cap(RED_CHANNEL(self),
> > SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4);
More information about the Spice-devel
mailing list