[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: convert malloc() to libxl__zalloc(NULL, ...)


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Thu, 07 Jun 2012 02:44:07 +0000
  • Delivery-date: Thu, 07 Jun 2012 02:44:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Dario Faggioli <raistlin@xxxxxxxx>
# Date 1338983177 -3600
# Node ID 47e83b338c527709124437a2947e86ea01a698f3
# Parent  6bea63e6c780de6303361e5f190d6925996cd2a2
libxl: convert malloc() to libxl__zalloc(NULL, ...)

And ditch the error handling in libxl_get_cpu_topology()

Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
[ ijc -- define and use NOGC instead of NULL to allow improvements to this
          infrastructure in the future ]
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 6bea63e6c780 -r 47e83b338c52 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl.c       Wed Jun 06 12:46:17 2012 +0100
@@ -3116,12 +3116,7 @@ libxl_cputopology *libxl_get_cpu_topolog
     if (tinfo.max_cpu_index < max_cpus - 1)
         max_cpus = tinfo.max_cpu_index + 1;
 
-    ret = malloc(sizeof(libxl_cputopology) * max_cpus);
-    if (ret == NULL) {
-        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
-                            "Unable to allocate return value");
-        goto fail;
-    }
+    ret = libxl__zalloc(NOGC, sizeof(libxl_cputopology) * max_cpus);
 
     for (i = 0; i < max_cpus; i++) {
 #define V(map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \
diff -r 6bea63e6c780 -r 47e83b338c52 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl_internal.h      Wed Jun 06 12:46:17 2012 +0100
@@ -1933,6 +1933,7 @@ struct libxl__domain_create_state {
 #define GC_INIT(ctx)  libxl__gc gc[1]; LIBXL_INIT_GC(gc[0],ctx)
 #define GC_FREE       libxl__free_all(gc)
 #define CTX           libxl__gc_owner(gc)
+#define NOGC          NULL
 
 /* Allocation macros all of which use the gc. */
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.