From 3c8ec17b26e686a6601e1a678c090f44464ad514 Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Fri, 5 Oct 2012 14:34:29 +0100 Subject: [PATCH] libxl: Move gc_is_real to libxl_internal.h. Signed-off-by: Anthony PERARD Acked-by: Ian Jackson Committed-by: Ian Campbell --- tools/libxl/libxl_internal.c | 11 +++-------- tools/libxl/libxl_internal.h | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index 211c8f5e2f..5a8cd38bf9 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -30,16 +30,11 @@ void libxl__alloc_failed(libxl_ctx *ctx, const char *func, #undef L } -static int gc_is_real(const libxl__gc *gc) -{ - return gc->alloc_maxsize >= 0; -} - void libxl__ptr_add(libxl__gc *gc, void *ptr) { int i; - if (!gc_is_real(gc)) + if (!libxl__gc_is_real(gc)) return; if (!ptr) @@ -71,7 +66,7 @@ void libxl__free_all(libxl__gc *gc) void *ptr; int i; - assert(gc_is_real(gc)); + assert(libxl__gc_is_real(gc)); for (i = 0; i < gc->alloc_maxsize; i++) { ptr = gc->alloc_ptrs[i]; @@ -111,7 +106,7 @@ void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size) if (ptr == NULL) { libxl__ptr_add(gc, new_ptr); - } else if (new_ptr != ptr && gc_is_real(gc)) { + } else if (new_ptr != ptr && libxl__gc_is_real(gc)) { for (i = 0; i < gc->alloc_maxsize; i++) { if (gc->alloc_ptrs[i] == ptr) { gc->alloc_ptrs[i] = new_ptr; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index b6f54bad17..c0e879d146 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -446,6 +446,11 @@ static inline libxl_ctx *libxl__gc_owner(libxl__gc *gc) return gc->owner; } +static inline int libxl__gc_is_real(const libxl__gc *gc) +{ + return gc->alloc_maxsize >= 0; +} + /* * Memory allocation tracking/helpers * -- 2.30.2