Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vbox/vbox_MSCOMGlue.c | 4 ++--
src/vbox/vbox_XPCOMCGlue.c | 2 +-
src/vbox/vbox_common.c | 30 +++++++++++++++---------------
src/vbox/vbox_network.c | 10 +++++-----
src/vbox/vbox_snapshot_conf.c | 12 ++++++------
src/vbox/vbox_storage.c | 2 +-
src/vbox/vbox_tmpl.c | 2 +-
7 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index db000385bc..18a291a0d8 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -525,8 +525,8 @@ vboxComInitialize_v2(const char *pszVirtualBoxIID, IVirtualBox
**ppVirtualBox,
CoInitialize(NULL);
- if (virAsprintf(&mbsVirtualBoxIID, "{%s}", pszVirtualBoxIID) < 0 ||
- virAsprintf(&mbsSessionIID, "{%s}", pszSessionIID) < 0)
+ mbsVirtualBoxIID = g_strdup_printf("{%s}", pszVirtualBoxIID);
+ mbsSessionIID = g_strdup_printf("{%s}", pszSessionIID)
goto cleanup;
if (vboxUtf8ToUtf16(mbsVirtualBoxIID, &wcsVirtualBoxIID) < 0 ||
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 09768d5d38..f48a78a923 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -85,7 +85,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing,
PFNVBOXGETXPCOMCFUNCTIONS pfnGetFunctions;
if (dir != NULL) {
- virAsprintf(&name, "%s/%s", dir, DYNLIB_NAME);
+ name = g_strdup_printf("%s/%s", dir, DYNLIB_NAME);
if (!virFileExists(name)) {
if (!ignoreMissing)
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 6ffa43addc..05656bffb2 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1770,7 +1770,7 @@ vboxAttachUSB(virDomainDefPtr def, vboxDriverPtr data, IMachine
*machine)
/* Zero pad for nice alignment when fewer than 9999
* devices.
*/
- virAsprintf(&filtername, "filter%04zu", i);
+ filtername = g_strdup_printf("filter%04zu", i);
VBOX_UTF8_TO_UTF16(filtername, &filternameUtf16);
VIR_FREE(filtername);
gVBoxAPI.UIUSBCommon.CreateDeviceFilter(USBCommon,
@@ -2126,7 +2126,7 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine,
vboxIID *iid
if (guiPresent) {
if (guiDisplay) {
char *displayutf8;
- virAsprintf(&displayutf8, "DISPLAY=%s", guiDisplay);
+ displayutf8 = g_strdup_printf("DISPLAY=%s", guiDisplay);
VBOX_UTF8_TO_UTF16(displayutf8, &env);
VIR_FREE(displayutf8);
VIR_FREE(guiDisplay);
@@ -2138,7 +2138,7 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine,
vboxIID *iid
if (sdlPresent) {
if (sdlDisplay) {
char *displayutf8;
- virAsprintf(&displayutf8, "DISPLAY=%s", sdlDisplay);
+ displayutf8 = g_strdup_printf("DISPLAY=%s", sdlDisplay);
VBOX_UTF8_TO_UTF16(displayutf8, &env);
VIR_FREE(displayutf8);
VIR_FREE(sdlDisplay);
@@ -4616,7 +4616,7 @@ vboxSnapshotRedefine(virDomainPtr dom,
}
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
- virAsprintf(&nameTmpUse, "%s.vbox", machineName);
+ nameTmpUse = g_strdup_printf("%s.vbox", machineName);
machineLocationPath = virStringReplace(settingsFilePath_Utf8, nameTmpUse,
"");
if (machineLocationPath == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -4632,8 +4632,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
goto cleanup;
}
if (snapshotMachineDesc->currentSnapshot != NULL) {
- virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml",
- machineLocationPath, snapshotMachineDesc->currentSnapshot);
+ currentSnapshotXmlFilePath = g_strdup_printf("%s%s.xml",
+ machineLocationPath,
snapshotMachineDesc->currentSnapshot);
snapshotFileExists = virFileExists(currentSnapshotXmlFilePath);
}
@@ -5201,8 +5201,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
vboxIIDUnalloc(&parentiid);
VBOX_UTF8_TO_UTF16("VDI", &formatUtf16);
- virAsprintf(&newLocationUtf8, "%sfakedisk-%d.vdi",
- machineLocationPath, it);
+ newLocationUtf8 = g_strdup_printf("%sfakedisk-%d.vdi",
+ machineLocationPath, it);
VBOX_UTF8_TO_UTF16(newLocationUtf8, &newLocation);
rc = gVBoxAPI.UIVirtualBox.CreateHardDisk(data->vboxObj,
formatUtf16,
@@ -5300,8 +5300,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
* next define. This file is saved as
"'machineLocation'/snapshot-'uuid'.xml"
*/
VIR_FREE(currentSnapshotXmlFilePath);
- virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml",
- machineLocationPath, snapshotMachineDesc->currentSnapshot);
+ currentSnapshotXmlFilePath = g_strdup_printf("%s%s.xml",
+ machineLocationPath,
snapshotMachineDesc->currentSnapshot);
char *snapshotContent = virDomainSnapshotDefFormat(NULL, def,
data->caps,
data->xmlopt,
@@ -6888,7 +6888,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
goto cleanup;
}
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
- virAsprintf(&nameTmpUse, "%s.vbox", machineName);
+ nameTmpUse = g_strdup_printf("%s.vbox", machineName);
machineLocationPath = virStringReplace(settingsFilepath, nameTmpUse, "");
if (machineLocationPath == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -6972,8 +6972,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
VBOX_UTF16_FREE(locationUtf16);
VBOX_UTF8_TO_UTF16("VDI", &formatUtf16);
- virAsprintf(&newLocationUtf8, "%sfakedisk-%s-%d.vdi",
- machineLocationPath, def->parent.parent_name, it);
+ newLocationUtf8 = g_strdup_printf("%sfakedisk-%s-%d.vdi",
+ machineLocationPath,
def->parent.parent_name, it);
VBOX_UTF8_TO_UTF16(newLocationUtf8, &newLocation);
rc = gVBoxAPI.UIVirtualBox.CreateHardDisk(data->vboxObj,
formatUtf16,
@@ -7377,13 +7377,13 @@ vboxDomainScreenshot(virDomainPtr dom,
}
if (privileged) {
- virAsprintf(&cacheDir, "%s/cache/libvirt", LOCALSTATEDIR);
+ cacheDir = g_strdup_printf("%s/cache/libvirt", LOCALSTATEDIR);
} else if (!(cacheDir = virGetUserCacheDirectory())) {
VBOX_RELEASE(machine);
return NULL;
}
- virAsprintf(&tmp, "%s/vbox.screendump.XXXXXX", cacheDir);
+ tmp = g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir);
if ((tmp_fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
virReportSystemError(errno, _("mkostemp(\"%s\") failed"),
tmp);
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index a942587bcb..19b4d23ed8 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -432,8 +432,8 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool
start)
VBOX_UTF16_TO_UTF8(networkInterfaceNameUtf16, &networkInterfaceNameUtf8);
- virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s",
- networkInterfaceNameUtf8);
+ networkNameUtf8 = g_strdup_printf("HostInterfaceNetworking-%s",
+ networkInterfaceNameUtf8);
VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16);
@@ -588,7 +588,7 @@ vboxNetworkUndefineDestroy(virNetworkPtr network, bool
removeinterface)
* show up in the net-list in virsh
*/
- virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s",
network->name);
+ networkNameUtf8 = g_strdup_printf("HostInterfaceNetworking-%s",
network->name);
VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16);
@@ -692,7 +692,7 @@ static int vboxNetworkCreate(virNetworkPtr network)
* server by giving the machine static IP
*/
- virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s",
network->name);
+ networkNameUtf8 = g_strdup_printf("HostInterfaceNetworking-%s",
network->name);
VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16);
@@ -789,7 +789,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int
flags)
def->ips = ipdef;
def->nips = 1;
- virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s",
network->name);
+ networkNameUtf8 = g_strdup_printf("HostInterfaceNetworking-%s",
network->name);
VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16);
diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c
index 8c92d8797b..acac037208 100644
--- a/src/vbox/vbox_snapshot_conf.c
+++ b/src/vbox/vbox_snapshot_conf.c
@@ -84,7 +84,7 @@ virVBoxSnapshotConfCreateVBoxSnapshotConfHardDiskPtr(xmlNodePtr
diskNode,
}
if (location[0] != '/') {
/*The location is a relative path, so we must change it into an absolute one. */
- virAsprintf(&tmp, "%s%s", machineLocation, location);
+ tmp = g_strdup_printf("%s%s", machineLocation, location);
hardDisk->location = g_strdup(tmp);
} else {
hardDisk->location = g_strdup(location);
@@ -330,7 +330,7 @@ virVBoxSnapshotConfCreateHardDiskNode(virVBoxSnapshotConfHardDiskPtr
hardDisk)
size_t i = 0;
char *uuid = NULL;
xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST "HardDisk");
- virAsprintf(&uuid, "{%s}", hardDisk->uuid);
+ uuid = g_strdup_printf("{%s}", hardDisk->uuid);
if (xmlNewProp(ret, BAD_CAST "uuid", BAD_CAST uuid) == NULL)
goto cleanup;
@@ -376,7 +376,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node,
char **secondRegex = NULL;
int secondRegexResult = 0;
- virAsprintf(&uuid, "{%s}", snapshot->uuid);
+ uuid = g_strdup_printf("{%s}", snapshot->uuid);
if (xmlNewProp(node, BAD_CAST "uuid", BAD_CAST uuid) == NULL)
goto cleanup;
@@ -397,7 +397,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node,
goto cleanup;
if (secondRegexResult < 1)
goto cleanup;
- virAsprintf(&timeStamp, "%sT%sZ", firstRegex[0], secondRegex[0]);
+ timeStamp = g_strdup_printf("%sT%sZ", firstRegex[0], secondRegex[0]);
if (xmlNewProp(node, BAD_CAST "timeStamp", BAD_CAST timeStamp) == NULL)
goto cleanup;
@@ -1069,7 +1069,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr
machine,
}
if (machine->currentSnapshot != NULL) {
- virAsprintf(¤tSnapshot, "{%s}",
machine->currentSnapshot);
+ currentSnapshot = g_strdup_printf("{%s}",
machine->currentSnapshot);
if (!xmlNewProp(machineNode, BAD_CAST "currentSnapshot", BAD_CAST
currentSnapshot)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Error in xmlNewProp"));
@@ -1106,7 +1106,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr
machine,
if (secondRegexResult < 1)
goto cleanup;
- virAsprintf(&timeStamp, "%sT%sZ", firstRegex[0], secondRegex[0]);
+ timeStamp = g_strdup_printf("%sT%sZ", firstRegex[0], secondRegex[0]);
if (!xmlNewProp(machineNode, BAD_CAST "lastStateChange", BAD_CAST
timeStamp)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Error in xmlNewProp"));
diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index 8cd1b20628..beb5b9e846 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -449,7 +449,7 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
/* If target.path isn't given, use default path ~/.VirtualBox/image_name */
if (!def->target.path)
- virAsprintf(&def->target.path, "%s/.VirtualBox/%s",
virGetUserDirectory(), def->name);
+ def->target.path = g_strdup_printf("%s/.VirtualBox/%s",
virGetUserDirectory(), def->name);
VBOX_UTF8_TO_UTF16(def->target.path, &hddNameUtf16);
if (!hddFormatUtf16 || !hddNameUtf16)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 88e7deaea0..a5a907768b 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -619,7 +619,7 @@ _virtualboxCreateMachine(vboxDriverPtr data, virDomainDefPtr def,
IMachine **mac
VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
vboxIIDFromUUID(&iid, def->uuid);
- virAsprintf(&createFlags, "UUID=%s,forceOverwrite=0", uuidstr);
+ createFlags = g_strdup_printf("UUID=%s,forceOverwrite=0", uuidstr);
VBOX_UTF8_TO_UTF16(createFlags, &createFlagsUtf16);
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
NULL,
--
2.21.0