[Spice-devel] [PATCH 09/14] server: make cursor channel private

Christophe Fergeau cfergeau at redhat.com
Mon Oct 26 02:59:41 PDT 2015


On Fri, Oct 23, 2015 at 10:29:04AM -0400, Frediano Ziglio wrote:
> It would be much better to define a public structure like
> 
> struct CursorChannel {
>    CommonChannel common;
> };
> 
> and a private one (in cursor-channel.c) like
> 
> struct CursorChannel {
>    CommonChannel common;
>    ... any field needed ...
> }
> 
> and define the macro as
> 
> #define RED_CHANNEL(Channel) (&(Channel)->common.base)

This kind of macros does not work as soon as you introduce another level
of inheritance:

struct SpecializedCursorChannel {
    CursorChannel parent;
    /* more stuff */
};

You cannot use your RED_CHANNEL macro to get a RedChannel from a
SpecializedCursorChannel instance.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151026/01878ef8/attachment.sig>


More information about the Spice-devel mailing list