From nobody Mon Feb 9 01:22:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571752925; cv=none; d=zoho.com; s=zohoarc; b=NYqPdSn3SfV+WUfp+OWkDypepqRq7Yuoti253gw2GTs4b3sPu0po9B8XX7YnuV+/Q5OfNK0GAxHTZSBEK+WMPnKamaov6TREVJOqxXrt3R7PdecaAjCZnavJogtmTZ87S1OdCQXMa9FhXD2iMQA/77ALohdqVslGFHVRadUx9Wk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571752925; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=op0UjjNzYog/YOls+nciD7fCBnO+WkGmBBsH5Tc5yNM=; b=TXv9zbjInNzvXVzEMnAnIvTKIY1wnupsnRpQmktKiF4im3M/uJomZORss0cmTWrNRG5zoUuAgB/Nes3v5Mh1/2G0PiFN1gGFdnc/Na6cofYhXb+u4p2VmOs8kZQmFBWrkD/9nKCTteCrTpI93LNkAGp72l2+Nis4eRuGbI6iA4U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1571752925297541.834256496457; Tue, 22 Oct 2019 07:02:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-4KknoX7TMRiBw_-lz0tYZw-1; Tue, 22 Oct 2019 10:01:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 805931005531; Tue, 22 Oct 2019 14:01:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 422CF1F3; Tue, 22 Oct 2019 14:01:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CD417180BA9C; Tue, 22 Oct 2019 14:01:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ME0u9I002854 for ; Tue, 22 Oct 2019 10:00:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA5146012C; Tue, 22 Oct 2019 14:00:56 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 428D16012D for ; Tue, 22 Oct 2019 14:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571752923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=op0UjjNzYog/YOls+nciD7fCBnO+WkGmBBsH5Tc5yNM=; b=VruDu/i5WZfrIKCMOus85Dlas8MyKDSSpyAAXizJ+/Yiq0/hw712Un+VRcgHzMvxZt2Pl/ t3uUAZSIEC75sMF/I1f77hpIY3/ZmsoDhjdVly4FnXB6SNo8mOLkmfzd00WFAkxrhwfN5+ WD6a/kuPmnt2V5RGv5PD0pdxDEFyeqU= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 22 Oct 2019 15:58:05 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 61/75] vbox: Use g_strdup_printf() instead of virAsprintf() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 4KknoX7TMRiBw_-lz0tYZw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- 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, IVir= tualBox **ppVirtualBox, =20 CoInitialize(NULL); =20 - if (virAsprintf(&mbsVirtualBoxIID, "{%s}", pszVirtualBoxIID) < 0 || - virAsprintf(&mbsSessionIID, "{%s}", pszSessionIID) < 0) + mbsVirtualBoxIID =3D g_strdup_printf("{%s}", pszVirtualBoxIID); + mbsSessionIID =3D g_strdup_printf("{%s}", pszSessionIID) goto cleanup; =20 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 ignoreM= issing, PFNVBOXGETXPCOMCFUNCTIONS pfnGetFunctions; =20 if (dir !=3D NULL) { - virAsprintf(&name, "%s/%s", dir, DYNLIB_NAME); + name =3D g_strdup_printf("%s/%s", dir, DYNLIB_NAME); =20 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 =3D 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, IMac= hine *machine, vboxIID *iid if (guiPresent) { if (guiDisplay) { char *displayutf8; - virAsprintf(&displayutf8, "DISPLAY=3D%s", guiDisplay); + displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", guiDisplay); VBOX_UTF8_TO_UTF16(displayutf8, &env); VIR_FREE(displayutf8); VIR_FREE(guiDisplay); @@ -2138,7 +2138,7 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMac= hine *machine, vboxIID *iid if (sdlPresent) { if (sdlDisplay) { char *displayutf8; - virAsprintf(&displayutf8, "DISPLAY=3D%s", sdlDisplay); + displayutf8 =3D g_strdup_printf("DISPLAY=3D%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); =20 - virAsprintf(&nameTmpUse, "%s.vbox", machineName); + nameTmpUse =3D g_strdup_printf("%s.vbox", machineName); machineLocationPath =3D virStringReplace(settingsFilePath_Utf8, nameTm= pUse, ""); if (machineLocationPath =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -4632,8 +4632,8 @@ vboxSnapshotRedefine(virDomainPtr dom, goto cleanup; } if (snapshotMachineDesc->currentSnapshot !=3D NULL) { - virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml", - machineLocationPath, snapshotMachineDesc->currentSnaps= hot); + currentSnapshotXmlFilePath =3D g_strdup_printf("%s%s.xml", + machineLocationPath, = snapshotMachineDesc->currentSnapshot); snapshotFileExists =3D virFileExists(currentSnapshotXmlFilePath); } =20 @@ -5201,8 +5201,8 @@ vboxSnapshotRedefine(virDomainPtr dom, vboxIIDUnalloc(&parentiid); VBOX_UTF8_TO_UTF16("VDI", &formatUtf16); =20 - virAsprintf(&newLocationUtf8, "%sfakedisk-%d.vdi", - machineLocationPath, it); + newLocationUtf8 =3D g_strdup_printf("%sfakedisk-%d.vdi", + machineLocationPath, it); VBOX_UTF8_TO_UTF16(newLocationUtf8, &newLocation); rc =3D 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->currentSnaps= hot); + currentSnapshotXmlFilePath =3D g_strdup_printf("%s%s.xml", + machineLocationPath, = snapshotMachineDesc->currentSnapshot); char *snapshotContent =3D virDomainSnapshotDefFormat(NULL, def, data->caps, data->xmlopt, @@ -6888,7 +6888,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) goto cleanup; } VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName); - virAsprintf(&nameTmpUse, "%s.vbox", machineName); + nameTmpUse =3D g_strdup_printf("%s.vbox", machineName); machineLocationPath =3D virStringReplace(settingsFilepath, nameTmpUse,= ""); if (machineLocationPath =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -6972,8 +6972,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) VBOX_UTF16_FREE(locationUtf16); VBOX_UTF8_TO_UTF16("VDI", &formatUtf16); =20 - virAsprintf(&newLocationUtf8, "%sfakedisk-%s-%d.vdi", - machineLocationPath, def->parent.parent_name, = it); + newLocationUtf8 =3D g_strdup_printf("%sfakedisk-%s-%d.vdi", + machineLocationPath, def= ->parent.parent_name, it); VBOX_UTF8_TO_UTF16(newLocationUtf8, &newLocation); rc =3D gVBoxAPI.UIVirtualBox.CreateHardDisk(data->vboxObj, formatUtf16, @@ -7377,13 +7377,13 @@ vboxDomainScreenshot(virDomainPtr dom, } =20 if (privileged) { - virAsprintf(&cacheDir, "%s/cache/libvirt", LOCALSTATEDIR); + cacheDir =3D g_strdup_printf("%s/cache/libvirt", LOCALSTATEDIR); } else if (!(cacheDir =3D virGetUserCacheDirectory())) { VBOX_RELEASE(machine); return NULL; } =20 - virAsprintf(&tmp, "%s/vbox.screendump.XXXXXX", cacheDir); + tmp =3D g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir); =20 if ((tmp_fd =3D mkostemp(tmp, O_CLOEXEC)) =3D=3D -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 ch= ar *xml, bool start) =20 VBOX_UTF16_TO_UTF8(networkInterfaceNameUtf16, &networkInterfaceNameUtf= 8); =20 - virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", - networkInterfaceNameUtf8); + networkNameUtf8 =3D g_strdup_printf("HostInterfaceNetworking-%s", + networkInterfaceNameUtf8); =20 VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); =20 @@ -588,7 +588,7 @@ vboxNetworkUndefineDestroy(virNetworkPtr network, bool = removeinterface) * show up in the net-list in virsh */ =20 - virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->n= ame); + networkNameUtf8 =3D g_strdup_printf("HostInterfaceNetworking-%s", netw= ork->name); =20 VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); =20 @@ -692,7 +692,7 @@ static int vboxNetworkCreate(virNetworkPtr network) * server by giving the machine static IP */ =20 - virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->n= ame); + networkNameUtf8 =3D g_strdup_printf("HostInterfaceNetworking-%s", netw= ork->name); =20 VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); =20 @@ -789,7 +789,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr networ= k, unsigned int flags) def->ips =3D ipdef; def->nips =3D 1; =20 - virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->n= ame); + networkNameUtf8 =3D g_strdup_printf("HostInterfaceNetworking-%s", netw= ork->name); =20 VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); =20 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(xmlN= odePtr diskNode, } if (location[0] !=3D '/') { /*The location is a relative path, so we must change it into an ab= solute one. */ - virAsprintf(&tmp, "%s%s", machineLocation, location); + tmp =3D g_strdup_printf("%s%s", machineLocation, location); hardDisk->location =3D g_strdup(tmp); } else { hardDisk->location =3D g_strdup(location); @@ -330,7 +330,7 @@ virVBoxSnapshotConfCreateHardDiskNode(virVBoxSnapshotCo= nfHardDiskPtr hardDisk) size_t i =3D 0; char *uuid =3D NULL; xmlNodePtr ret =3D xmlNewNode(NULL, BAD_CAST "HardDisk"); - virAsprintf(&uuid, "{%s}", hardDisk->uuid); + uuid =3D g_strdup_printf("{%s}", hardDisk->uuid); =20 if (xmlNewProp(ret, BAD_CAST "uuid", BAD_CAST uuid) =3D=3D NULL) goto cleanup; @@ -376,7 +376,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, char **secondRegex =3D NULL; int secondRegexResult =3D 0; =20 - virAsprintf(&uuid, "{%s}", snapshot->uuid); + uuid =3D g_strdup_printf("{%s}", snapshot->uuid); =20 if (xmlNewProp(node, BAD_CAST "uuid", BAD_CAST uuid) =3D=3D 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 =3D g_strdup_printf("%sT%sZ", firstRegex[0], secondRegex[0]); =20 if (xmlNewProp(node, BAD_CAST "timeStamp", BAD_CAST timeStamp) =3D=3D = NULL) goto cleanup; @@ -1069,7 +1069,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMa= chinePtr machine, } =20 if (machine->currentSnapshot !=3D NULL) { - virAsprintf(¤tSnapshot, "{%s}", machine->currentSnapshot); + currentSnapshot =3D g_strdup_printf("{%s}", machine->currentSnapsh= ot); if (!xmlNewProp(machineNode, BAD_CAST "currentSnapshot", BAD_CAST = currentSnapshot)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Error in xmlNewProp")); @@ -1106,7 +1106,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMa= chinePtr machine, if (secondRegexResult < 1) goto cleanup; =20 - virAsprintf(&timeStamp, "%sT%sZ", firstRegex[0], secondRegex[0]); + timeStamp =3D g_strdup_printf("%sT%sZ", firstRegex[0], secondRegex[0]); if (!xmlNewProp(machineNode, BAD_CAST "lastStateChange", BAD_CAST time= Stamp)) { 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, =20 /* If target.path isn't given, use default path ~/.VirtualBox/image_na= me */ if (!def->target.path) - virAsprintf(&def->target.path, "%s/.VirtualBox/%s", virGetUserDire= ctory(), def->name); + def->target.path =3D g_strdup_printf("%s/.VirtualBox/%s", virGetUs= erDirectory(), def->name); VBOX_UTF8_TO_UTF16(def->target.path, &hddNameUtf16); =20 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, virDomainD= efPtr def, IMachine **mac =20 VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16); vboxIIDFromUUID(&iid, def->uuid); - virAsprintf(&createFlags, "UUID=3D%s,forceOverwrite=3D0", uuidstr); + createFlags =3D g_strdup_printf("UUID=3D%s,forceOverwrite=3D0", uuidst= r); VBOX_UTF8_TO_UTF16(createFlags, &createFlagsUtf16); rc =3D data->vboxObj->vtbl->CreateMachine(data->vboxObj, NULL, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list