Re: [PATCH spice-server v2 1/2] Introduce some macros to help declaring new GObject

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

 



> 
> > 
> > On Thu, Sep 07, 2017 at 03:58:21AM -0400, Frediano Ziglio wrote:
> > > > 
> > > > On Wed, Sep 06, 2017 at 03:42:29PM +0100, Frediano Ziglio wrote:
> > > > > The macros will implement most of the boilerplate needed
> > > > > to declare an object.
> > > > > Their usage are similar to GLib G_DECLARE_*_TYPE macros.
> > > > 
> > > > Can we/should we use the GLib provided macros when they are available,
> > > > and copy/paste the GLib implementation in a -compat.h header for older
> > > > systems. The GLib macros were introduced in GLib 2.43.4
> > > > 
> > > > Christophe
> > > > 
> > > 
> > > That's fine. But our objects are currently neither final neither
> > > interfaces
> > > so we can't use any of them.
> > 
> > MainChannel, CursorChannel, ... could be considered final, RedChannel,
> > ... could most likely use G_DECLARE_DERIVABLE_TYPE. But the GLib macros
> > might
> > not exactly match what we are doing (naming, private data, ..).
> > 
> > Christophe
> > 
> 
> Actually GLib macros are not C99 compatibles which I don't like that
> much.
> They also rely on 2.38 version for private support while we require
> just 2.28 (there's no fields in the structure, all are private and
> there's guarantee that private data have a fixed offset).
> Another difference is that they require a MODULE while in most cases
> we don't use it. Maybe we should have always a module (would be RED
> in our case) but looks like lot of sed in the code which won't help
> the history much.
> If in the future we decide to move to the official macros I think
> this is a step forward and helps adding new classes and be more
> consistent.
> 

I checked the GLib source to check if was possible to write some
compatibility macros for 2.28. Is not possible without introducing
lot of changes or other workaround macros to handle both cases.
The internal layout of GObject allocation changed moving private
data at the beginning of the object allowing to have constant
offsets to the private data. The 2.28 layout is to have private
data at the end of the object so the offset changes based on
the specific instance type.

Frediano
_______________________________________________
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]