xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Xen Devel <xen-devel@lists.xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH V3 1/3] libxl: Move gc_is_real to libxl_internal.h.
Date: Fri, 5 Oct 2012 10:04:29 +0100	[thread overview]
Message-ID: <1349427871-31195-2-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1349427871-31195-1-git-send-email-anthony.perard@citrix.com>

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 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 211c8f5..5a8cd38 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 b6f54ba..c0e879d 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
  *
-- 
Anthony PERARD

  reply	other threads:[~2012-10-05  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05  9:04 [PATCH V3 0/3] Cleanup: flexarray taking gc Anthony PERARD
2012-10-05  9:04 ` Anthony PERARD [this message]
2012-10-05 10:15   ` [PATCH V3 1/3] libxl: Move gc_is_real to libxl_internal.h Ian Jackson
2012-10-05  9:04 ` [PATCH V3 2/3] libxl: Have flexarray using the GC Anthony PERARD
2012-10-05 10:15   ` Ian Jackson
2012-10-05  9:04 ` [PATCH V3 3/3] libxl_json: Use libxl alloc function Anthony PERARD
2012-10-05 13:44 ` [PATCH V3 0/3] Cleanup: flexarray taking gc Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349427871-31195-2-git-send-email-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).