And ditch the error handling in libxl_get_cpu_topology()
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- define and use NOGC instead of NULL to allow improvements to this
infrastructure in the future ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
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) ? \
#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. */