diff options
author | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-12-12 17:48:42 +0000 |
---|---|---|
committer | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-12-12 17:48:42 +0000 |
commit | bdf07e8ed2690fb5e39371e6672df9dd30495a29 (patch) | |
tree | df05b986a82b8dd9a223f05abe7559783bec892e /tools/libxl/libxl_utils.c | |
parent | f6678b04991744e0024678835b9afb32dfe9fa36 (diff) | |
download | xen-bdf07e8ed2690fb5e39371e6672df9dd30495a29.tar.gz xen-bdf07e8ed2690fb5e39371e6672df9dd30495a29.tar.bz2 xen-bdf07e8ed2690fb5e39371e6672df9dd30495a29.zip |
libxl: Use GC_INIT and GC_FREE everywhere
Replace
libxl__gc gc = LIBXL_INIT_GC(ctx);
...
libxl__free_all(&gc);
with
GC_INIT(ctx);
...
GC_FREE;
throughout with a couple of perl runes.
We must then adjust uses of the resulting gc for pointerness, which is
mostly just replacing all occurrences of "&gc" with "gc". Also a
couple of unusual uses of LIBXL_INIT_GC needed to be fixed up by hand.
Here are those runes:
perl -i -pe 's/\Q libxl__gc gc = LIBXL_INIT_GC(ctx);/ GC_INIT(ctx);/' tools/libxl/*.c
perl -i -pe 's/\Q libxl__free_all(&gc);/ GC_FREE;/' tools/libxl/*.c
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index f1f2a6d6b6..d36c737e9b 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -186,29 +186,29 @@ char *libxl_schedid_to_name(libxl_ctx *ctx, int schedid) int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid) { - libxl__gc gc = LIBXL_INIT_GC(ctx); + GC_INIT(ctx); char * stubdom_id_s; int ret; - stubdom_id_s = libxl__xs_read(&gc, XBT_NULL, - libxl__sprintf(&gc, "%s/image/device-model-domid", - libxl__xs_get_dompath(&gc, guest_domid))); + stubdom_id_s = libxl__xs_read(gc, XBT_NULL, + libxl__sprintf(gc, "%s/image/device-model-domid", + libxl__xs_get_dompath(gc, guest_domid))); if (stubdom_id_s) ret = atoi(stubdom_id_s); else ret = 0; - libxl__free_all(&gc); + GC_FREE; return ret; } int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid) { - libxl__gc gc = LIBXL_INIT_GC(ctx); + GC_INIT(ctx); char *target, *endptr; uint32_t value; int ret = 0; - target = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/target", libxl__xs_get_dompath(&gc, domid))); + target = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, domid))); if (!target) goto out; value = strtol(target, &endptr, 10); @@ -218,7 +218,7 @@ int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid) *target_domid = value; ret = 1; out: - libxl__free_all(&gc); + GC_FREE; return ret; } @@ -240,27 +240,27 @@ static int logrename(libxl__gc *gc, const char *old, const char *new) int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name) { - libxl__gc gc = LIBXL_INIT_GC(ctx); + GC_INIT(ctx); struct stat stat_buf; char *logfile, *logfile_new; int i, rc; - logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name); + logfile = libxl__sprintf(gc, "/var/log/xen/%s.log", name); if (stat(logfile, &stat_buf) == 0) { /* file exists, rotate */ - logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.10", name); + logfile = libxl__sprintf(gc, "/var/log/xen/%s.log.10", name); unlink(logfile); for (i = 9; i > 0; i--) { - logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i); - logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i + 1); - rc = logrename(&gc, logfile, logfile_new); + logfile = libxl__sprintf(gc, "/var/log/xen/%s.log.%d", name, i); + logfile_new = libxl__sprintf(gc, "/var/log/xen/%s.log.%d", name, i + 1); + rc = logrename(gc, logfile, logfile_new); if (rc) goto out; } - logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name); - logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.1", name); + logfile = libxl__sprintf(gc, "/var/log/xen/%s.log", name); + logfile_new = libxl__sprintf(gc, "/var/log/xen/%s.log.1", name); - rc = logrename(&gc, logfile, logfile_new); + rc = logrename(gc, logfile, logfile_new); if (rc) goto out; } else { @@ -272,7 +272,7 @@ int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name) *full_name = strdup(logfile); rc = 0; out: - libxl__free_all(&gc); + GC_FREE; return rc; } |