[Spice-devel] [PATCH] macros: do not use more type safe CONTAINEROF version if not requested

Christophe Fergeau cfergeau at redhat.com
Wed Mar 2 07:39:08 UTC 2016


On Tue, Mar 01, 2016 at 02:41:32PM -0500, Frediano Ziglio wrote:
> > 
> > On Tue, Mar 01, 2016 at 09:44:39AM +0000, Frediano Ziglio wrote:
> > > This prevents incompatibility if users (like old spice-server/spice-gtk)
> > > are not expected to have this additional restriction.
> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > >  spice/macros.h | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > I defined a new SPICE_CONTAINEROF_MORESAFE macro to enable this extra check
> > > on the type of member. Not really happy with the name.
> > 
> > SPICE_TYPESAFE_CONTAINEROF ?
> 
> I don't think macro can be even really typesafe.. it's more type safe :)
> 
> SPICE_MORE_TYPESAFE_CONTAINEROF ?

SPICE_USE_SAFER_CONTAINEROF then ? (or _STRICTER_ )

> 
> > This could go with a comment above saying that this define is used to
> > avoid compilation breakage with older spice-server releases which
> > triggered some errors without an additional patch.
> > 
> 
> Can do it.
> 
> > > Could be something related to the version of spice-protocol expected works
> > > out?
> > 
> > 
> > I'm not sure what you are suggesting here.
> > 
> 
> Somethink like
> 
> #define SPICE_PROTOCOL_MINIMUM 0x0c0a00 /* 0.12.10 */
> 
> in spice-server and
> 
> #ifndef SPICE_PROTOCOL_MINIMUM
> #define SPICE_PROTOCOL_MINIMUM 0x0
> #endif
> 
> #if SPICE_PROCOTOL_MINIMUM >= 0x0c0a00
> // use more safe macro
> #else
> // compatible one
> #endif

Ah, I think I prefer having a specialized #define (ie your current
patch).

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


More information about the Spice-devel mailing list