libxl: Move gc_is_real to libxl_internal.h.
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 5 Oct 2012 13:34:29 +0000 (14:34 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Fri, 5 Oct 2012 13:34:29 +0000 (14:34 +0100)
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_internal.c
tools/libxl/libxl_internal.h

index 211c8f5e2f26d0eaab2a2f5e6aee90fbd8a2415a..5a8cd38bf922b85a7f39c3d58a840e0964772384 100644 (file)
@@ -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;
index b6f54bad17d248ffa407a6093d6080b8fe320892..c0e879d146ae53a7a83f7d24fdd4f393a7da9b22 100644 (file)
@@ -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
  *