From 3bfb359944f5b41d7d9605041e967f060f1d40fd Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 22 Oct 2019 15:26:14 +0200 Subject: [PATCH] vmx: Use g_strdup_printf() instead of virAsprintf() Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/vmx/vmx.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index e0b06accf5..2cd6fc6049 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2081,8 +2081,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con goto cleanup; } - if (virAsprintf(&prefix, "scsi%d:%d", controllerOrBus, unit) < 0) - goto cleanup; + prefix = g_strdup_printf("scsi%d:%d", controllerOrBus, unit); (*def)->dst = virIndexToDiskName @@ -2104,8 +2103,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con goto cleanup; } - if (virAsprintf(&prefix, "ide%d:%d", controllerOrBus, unit) < 0) - goto cleanup; + prefix = g_strdup_printf("ide%d:%d", controllerOrBus, unit); (*def)->dst = virIndexToDiskName(controllerOrBus * 2 + unit, "hd"); @@ -2134,8 +2132,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con goto cleanup; } - if (virAsprintf(&prefix, "floppy%d", unit) < 0) - goto cleanup; + prefix = g_strdup_printf("floppy%d", unit); (*def)->dst = virIndexToDiskName(unit, "fd"); @@ -2842,9 +2839,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, (*def)->source->data.tcp.host = g_strdup(parsedUri->server); - if (virAsprintf(&(*def)->source->data.tcp.service, "%d", - parsedUri->port) < 0) - goto cleanup; + (*def)->source->data.tcp.service = g_strdup_printf("%d", parsedUri->port); /* See vSphere API documentation about VirtualSerialPortURIBackingInfo */ if (parsedUri->scheme == NULL ||