From 4ecf8aa5a06a830b05c035a5d6184bf991931d20 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 16 Jan 2013 18:22:29 +0100 Subject: pseries: Replace non-portable asprintf by g_strdup_printf g_strdup_printf already handles OOM errors, so some error handling in QEMU code can be removed. Signed-off-by: Stefan Weil Signed-off-by: Anthony Liguori --- hw/spapr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'hw/spapr.c') diff --git a/hw/spapr.c b/hw/spapr.c index 21c261b..d80b792 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -328,14 +328,11 @@ static void *spapr_create_fdt_skel(const char *cpu_model, continue; } - if (asprintf(&nodename, "%s@%x", modelname, index) < 0) { - fprintf(stderr, "Allocation failure\n"); - exit(1); - } + nodename = g_strdup_printf("%s@%x", modelname, index); _FDT((fdt_begin_node(fdt, nodename))); - free(nodename); + g_free(nodename); _FDT((fdt_property_cell(fdt, "reg", index))); _FDT((fdt_property_string(fdt, "device_type", "cpu"))); -- cgit v1.1