[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: make LIBXL_INIT_GC a statement, not an initialiser
# HG changeset patch # User Ian Jackson <ian.jackson@xxxxxxxxxxxxx> # Date 1326473651 0 # Node ID 5eba2a0c61a25beb162aea984a37589d481cf09d # Parent 5ac7713e7f5d9711770ec9d2e555bf82e086dc98 libxl: make LIBXL_INIT_GC a statement, not an initialiser Previously LIBXL_INIT_GC was an initialiser, which you were expected to use like this: libxl__gc gc = LIBXL_INIT_GC(ctx); But we are going to want to put things in the gc which are to be initialised using other macros. That means that LIBXL_INIT_GC has to become a statement too. So instead, we make it so that it's used like this: libxl_gc gc; LIBXL_INIT_GC(gc,ctx); In fact there are only a couple of callers now, including GC_INIT which uses this trick: libxl_gc gc[1]; LIBXL_INIT_GC(gc[0],ctx); Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- diff -r 5ac7713e7f5d -r 5eba2a0c61a2 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Fri Jan 13 16:54:09 2012 +0000 +++ b/tools/libxl/libxl_internal.h Fri Jan 13 16:54:11 2012 +0000 @@ -147,7 +147,12 @@ libxl_ctx *owner; } libxl__gc; -#define LIBXL_INIT_GC(ctx) (libxl__gc){ .alloc_maxsize = 0, .alloc_ptrs = 0, .owner = ctx } +#define LIBXL_INIT_GC(gc,ctx) do{ \ + (gc).alloc_maxsize = 0; \ + (gc).alloc_ptrs = 0; \ + (gc).owner = (ctx); \ + } while(0) + static inline libxl_ctx *libxl__gc_owner(libxl__gc *gc) { return gc->owner; @@ -725,7 +730,7 @@ * as a local variable. */ -#define GC_INIT(ctx) libxl__gc gc[1] = { LIBXL_INIT_GC(ctx) } +#define GC_INIT(ctx) libxl__gc gc[1]; LIBXL_INIT_GC(gc[0],ctx) #define GC_FREE libxl__free_all(gc) #define CTX libxl__gc_owner(gc) diff -r 5ac7713e7f5d -r 5eba2a0c61a2 tools/libxl/libxl_qmp.c --- a/tools/libxl/libxl_qmp.c Fri Jan 13 16:54:09 2012 +0000 +++ b/tools/libxl/libxl_qmp.c Fri Jan 13 16:54:11 2012 +0000 @@ -513,7 +513,7 @@ { char *buf = NULL; int rc = -1; - libxl__gc gc = LIBXL_INIT_GC(qmp->ctx); + libxl__gc gc; LIBXL_INIT_GC(gc,qmp->ctx); buf = qmp_send_prepare(&gc, qmp, cmd, args, callback, opaque, context); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |