Re: [PATCH 10/10] Move RedCharDeviceCallbacks into RedCharDeviceClass

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

 



Hey,

On Thu, Apr 07, 2016 at 11:58:05AM -0500, Jonathon Jongsma wrote:
> On Thu, 2016-04-07 at 11:54 +0200, Christophe Fergeau wrote:
> > On Fri, Apr 01, 2016 at 03:51:44PM -0500, Jonathon Jongsma wrote:
> > > diff --git a/server/smartcard.c b/server/smartcard.c
> > > index 52d56ea..0238efe 100644
> > > --- a/server/smartcard.c
> > > +++ b/server/smartcard.c
> > > @@ -272,14 +272,6 @@ static SpiceCharDeviceInstance
> > > *smartcard_readers_get_unattached(void)
> > >  static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds,
> > > SpiceCharDeviceInstance *sin)
> > >  {
> > >      RedCharDevice *char_dev;
> > > -    RedCharDeviceCallbacks char_dev_cbs = {
> > > -        .read_one_msg_from_device = smartcard_read_msg_from_device,
> > > -        .ref_msg_to_client = smartcard_ref_msg_to_client,
> > > -        .unref_msg_to_client = smartcard_unref_msg_to_client,
> > > -        .send_msg_to_client = smartcard_send_msg_to_client,
> > > -        .send_tokens_to_client = smartcard_send_tokens_to_client,
> > > -        .remove_client = smartcard_remove_client,
> > > -    };
> > >  
> > >      char_dev = g_object_new(RED_TYPE_CHAR_DEVICE_SMARTCARD,
> > >                              "sin", sin,
> > > @@ -288,8 +280,8 @@ static RedCharDeviceSmartcard
> > > *smartcard_device_new(RedsState *reds, SpiceCharDe
> > >                              "self-tokens", ~0ULL,
> > >                              NULL);
> > >  
> > > -    red_char_device_set_callbacks(RED_CHAR_DEVICE(char_dev),
> > > -                                  &char_dev_cbs, char_dev);
> > > +    g_object_set(char_dev, "opaque", char_dev, NULL);
> > > +
> > 
> > I'm not sure why this is done in a separate call here rather than being
> > added to the g_object_new call just before as for the other
> > RedCharDevice children.
> 
> It's done this way because it's setting 'opaque' to the result of g_object_new.
> Which is a little bit odd -- the functions should really be passed a 'self'
> argument instead of having to set  self as the 'opaque' data argument. But
> that's how it's done at the moment.

Ah right, makes sense then. For what it's worth I have a set of patches
getting rid of "opaque" altogether, I'll send these once I have cleaned
them up.

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

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]