WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools/libxl: remove libxl_free() since th

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools/libxl: remove libxl_free() since there are no more callers
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Aug 2010 07:00:56 -0700
Delivery-date: Wed, 18 Aug 2010 07:05:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1281962359 -3600
# Node ID def814437d4247eced1218e5bcd5c583bf7df0bb
# Parent  1382296539fc73e259e96b1d8d59ab285a24712d
tools/libxl: remove libxl_free() since there are no more callers

libxl_free() allows allocated memory to be explicitly free'd from a
libxl_gc. Every previous use of this function has now been made
redundant and therefore has been removed. We can safely kill it and
amend the policy accordingly.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.h          |    7 +++----
 tools/libxl/libxl_internal.c |   19 -------------------
 tools/libxl/libxl_internal.h |    1 -
 3 files changed, 3 insertions(+), 24 deletions(-)

diff -r 1382296539fc -r def814437d42 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Mon Aug 16 13:37:58 2010 +0100
+++ b/tools/libxl/libxl.h       Mon Aug 16 13:39:19 2010 +0100
@@ -117,10 +117,9 @@
  *     and an internal wrapper adds the relevant pointers to the gc.
  *     The latter method is preferred for obvious performance reasons.
  *
- * No temporary objects allocated from the pool should be explicitly freed.
- * Calling libxl_free_all() before returning from a public functions will do
- * this. The upshot of this is that almost all calls to libxl_free() are
- * erroneous.
+ * No temporary objects allocated from the pool may be explicitly freed.
+ * Therefore public functions which initialize a libxl_gc MUST call
+ * libxl_free_all() before returning.
  */
 #ifndef LIBXL_H
 #define LIBXL_H
diff -r 1382296539fc -r def814437d42 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Mon Aug 16 13:37:58 2010 +0100
+++ b/tools/libxl/libxl_internal.c      Mon Aug 16 13:39:19 2010 +0100
@@ -57,25 +57,6 @@ int libxl_ptr_add(libxl_gc *gc, void *pt
     gc->alloc_ptrs = re;
     gc->alloc_maxsize += 25;
     return 0;
-}
-
-void libxl_free(libxl_gc *gc, void *ptr)
-{
-    int i;
-
-    if (!ptr)
-        return;
-
-    /* remove the pointer from the tracked ptrs */
-    for (i = 0; i < gc->alloc_maxsize; i++) {
-        if (gc->alloc_ptrs[i] == ptr) {
-            gc->alloc_ptrs[i] = NULL;
-            free(ptr);
-            return;
-        }
-    }
-    /* haven't find the pointer, really bad */
-    abort();
 }
 
 void libxl_free_all(libxl_gc *gc)
diff -r 1382296539fc -r def814437d42 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Aug 16 13:37:58 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Mon Aug 16 13:39:19 2010 +0100
@@ -129,7 +129,6 @@ static inline libxl_ctx *libxl_gc_owner(
 
 /* memory allocation tracking/helpers */
 _hidden int libxl_ptr_add(libxl_gc *gc, void *ptr);
-_hidden void libxl_free(libxl_gc *gc, void *ptr);
 _hidden void libxl_free_all(libxl_gc *gc);
 _hidden void *libxl_zalloc(libxl_gc *gc, int bytes);
 _hidden void *libxl_calloc(libxl_gc *gc, size_t nmemb, size_t size);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools/libxl: remove libxl_free() since there are no more callers, Xen patchbot-unstable <=