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] libxl: Introduce libxl__realloc.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce libxl__realloc.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 01 Oct 2011 03:33:13 +0100
Delivery-date: Fri, 30 Sep 2011 19:34:10 -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 Anthony PERARD <anthony.perard@xxxxxxxxxx>
# Date 1317310102 -3600
# Node ID 952e0118a7c47c467c34f24f9c271902eed3bc99
# Parent  f51dcd8acb7b950c870d23d250f56ad542997ae9
libxl: Introduce libxl__realloc.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r f51dcd8acb7b -r 952e0118a7c4 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.c      Thu Sep 29 16:28:22 2011 +0100
@@ -102,6 +102,30 @@
     return ptr;
 }
 
+void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size)
+{
+    void *new_ptr = realloc(ptr, new_size);
+    int i = 0;
+
+    if (new_ptr == NULL && new_size != 0) {
+        return NULL;
+    }
+
+    if (ptr == NULL) {
+        libxl__ptr_add(gc, new_ptr);
+    } else if (new_ptr != ptr) {
+        for (i = 0; i < gc->alloc_maxsize; i++) {
+            if (gc->alloc_ptrs[i] == ptr) {
+                gc->alloc_ptrs[i] = new_ptr;
+                break;
+            }
+        }
+    }
+
+
+    return new_ptr;
+}
+
 char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...)
 {
     char *s;
diff -r f51dcd8acb7b -r 952e0118a7c4 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Thu Sep 29 16:28:22 2011 +0100
@@ -145,6 +145,7 @@
 _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);
+_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) 
PRINTF_ATTRIBUTE(2, 3);
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);

_______________________________________________
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] libxl: Introduce libxl__realloc., Xen patchbot-unstable <=