Re: [spice-server 2/8] Move RedChannel::data to ClientCbs::cbs_data

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

 



On Thu, Mar 24, 2016 at 12:21:05PM -0400, Frediano Ziglio wrote:
> > 
> > On Tue, Mar 15, 2016 at 05:11:36PM -0400, Frediano Ziglio wrote:
> > > > -static void red_channel_client_default_disconnect(RedChannelClient
> > > > *base)
> > > > +static void red_channel_client_default_disconnect(RedChannelClient
> > > > *base,
> > > > gpointer cbs_data)
> > > >  {
> > > >      red_channel_client_disconnect(base);
> > > >  }
> > > > @@ -1062,7 +1062,7 @@ RedChannel *red_channel_create(int size,
> > > >  
> > > >      client_cbs.connect = red_channel_client_default_connect;
> > > >      client_cbs.disconnect = red_channel_client_default_disconnect;
> > > > -    client_cbs.migrate = red_channel_client_default_migrate;
> > > > +    client_cbs.migrate =
> > > > (channel_client_migrate_proc)red_channel_client_default_migrate;
> > > > 
> > > 
> > > I don't like these kind of cast. Why don't you add a parameter (unused)
> > > to these functions?
> > 
> > red_channel_client_default_migrate() is not used only as a
> > ClientCbs::migrate vfunc, it's also called a few times in other code
> > (red_migrate_display() for example).
> > red_channel_client_default_migrate(rcc, NULL) did not look so great
> > there, and I prefer to have a cast rather than an intermediate function
> > with the right number of args calling directly the real function with
> > one arg less.
> > 
> > Christophe
> > 
> 
> I still don't like these casts.
> 
> What about this:
> https://cgit.freedesktop.org/~fziglio/spice-server/commit/?h=christophe&id=f3660395933ccd3198d59f52c02d6bb6f34788e7

Well, this is what I said in the previous email that I'm not a big fan
of ;)
« red_channel_client_default_migrate(rcc, NULL) did not look so
great there, and I prefer to have a cast rather than an intermediate
function with the right number of args calling directly the real
function with one arg less. »

> 
> Actually considering this function
> 
> static void red_channel_client_migrate_client(RedChannelClient *rcc)
> {
>     rcc->channel->client_cbs.migrate(rcc, rcc->channel->client_cbs.cbs_data);
> }
> 
> why not using rcc->channel->client_cbs.cbs_data inside the callback?
> Without the parameter change both subject and comment make sense so looks like
> adding the parameter is not necessary.

This assumes we are fine with the callback knowing about
RedChannelClient internals, and being able to access them. In my opinion
it's better if at least in the API, RedChannelClient could be a black
box.

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]