Since commit 44e7f029159ed701b4a1739ac711507ee53790ed
util: rewrite auto cleanup macros to use glib's equivalent
VIR_AUTOCLEAN is just an alias for g_auto. Use the GLib macros
directly instead of our custom aliases.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/conf/domain_conf.c | 100 +++++++++++++-------------
src/libxl/xen_common.c | 2 +-
src/qemu/qemu_command.c | 136 +++++++++++++++++------------------
src/qemu/qemu_domain.c | 28 ++++----
src/qemu/qemu_firmware.c | 2 +-
src/qemu/qemu_monitor_json.c | 2 +-
src/util/virbuffer.h | 2 +-
src/util/virjson.c | 2 +-
tests/qemublocktest.c | 8 +--
tests/qemumonitortestutils.c | 2 +-
tests/virbuftest.c | 6 +-
tests/virstoragetest.c | 2 +-
tests/virsystemdtest.c | 2 +-
13 files changed, 147 insertions(+), 147 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 10d6bf0eea..16b939d511 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7095,8 +7095,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
virDomainDeviceInfoPtr info,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) {
@@ -24139,7 +24139,7 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr buf,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
if (!(flags & VIR_DOMAIN_DEF_FORMAT_STATUS) ||
@@ -24183,8 +24183,8 @@ virDomainDiskSourceFormat(virBufferPtr buf,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
@@ -24271,8 +24271,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
virStorageSourcePtr backingStore = src->backingStore;
@@ -24435,8 +24435,8 @@ virDomainDiskDefFormatMirror(virBufferPtr buf,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
const char *formatStr = NULL;
virBufferSetChildIndent(&childBuf, buf);
@@ -24488,7 +24488,7 @@ virDomainDiskDefFormatPrivateData(virBufferPtr buf,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
if (!(flags & VIR_DOMAIN_DEF_FORMAT_STATUS) ||
!xmlopt ||
@@ -24637,7 +24637,7 @@ static int
virDomainControllerDriverFormat(virBufferPtr buf,
virDomainControllerDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
if (def->queues)
virBufferAsprintf(&driverBuf, " queues='%u'",
def->queues);
@@ -24670,8 +24670,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
const char *type = virDomainControllerTypeToString(def->type);
const char *model = NULL;
const char *modelName = NULL;
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
@@ -24839,7 +24839,7 @@ virDomainFSDefFormat(virBufferPtr buf,
const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
const char *src = def->src->path;
- VIR_AUTOCLEAN(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
if (!type) {
@@ -25442,7 +25442,7 @@ virDomainNetDefFormat(virBufferPtr buf,
const char *typeStr;
virDomainHostdevDefPtr hostdef = NULL;
char macstr[VIR_MAC_STRING_BUFLEN];
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
/* publicActual is true if we should report the current state in
* def->data.network.actual *instead of* the config (*not* in
@@ -25785,8 +25785,8 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
virDomainChrSourceDefPtr def,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
@@ -26070,7 +26070,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *mode = virDomainSmartcardTypeToString(def->type);
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
size_t i;
int ret = -1;
@@ -26203,7 +26203,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *model = virDomainSoundModelTypeToString(def->model);
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
size_t i;
int ret = -1;
@@ -26246,9 +26246,9 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *model = virDomainMemballoonModelTypeToString(def->model);
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
if (!model) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -26302,8 +26302,8 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
{
const char *model = virDomainWatchdogModelTypeToString(def->model);
const char *action = virDomainWatchdogActionTypeToString(def->action);
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
@@ -26330,8 +26330,8 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
static int virDomainPanicDefFormat(virBufferPtr buf,
virDomainPanicDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
if (def->model)
virBufferAsprintf(&attrBuf, " model='%s'",
@@ -26391,7 +26391,7 @@ virDomainRNGDefFormat(virBufferPtr buf,
{
const char *model = virDomainRNGModelTypeToString(def->model);
const char *backend = virDomainRNGBackendTypeToString(def->backend);
- VIR_AUTOCLEAN(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(buf, "<rng model='%s'>\n", model);
virBufferAdjustIndent(buf, 2);
@@ -26585,7 +26585,7 @@ virDomainVideoDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *model = virDomainVideoTypeToString(def->type);
- VIR_AUTOCLEAN(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
if (!model) {
@@ -26656,9 +26656,9 @@ virDomainInputDefFormat(virBufferPtr buf,
{
const char *type = virDomainInputTypeToString(def->type);
const char *bus = virDomainInputBusTypeToString(def->bus);
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
/* don't format keyboard into migratable XML for backward compatibility */
if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
@@ -27388,8 +27388,8 @@ virDomainHubDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *type = virDomainHubTypeToString(def->type);
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
@@ -27656,7 +27656,7 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
virDomainResctrlDefPtr resctrl,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
size_t i = 0;
int ret = -1;
VIR_AUTOFREE(char *) vcpus = NULL;
@@ -27725,7 +27725,7 @@ virDomainMemorytuneDefFormat(virBufferPtr buf,
virDomainResctrlDefPtr resctrl,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
VIR_AUTOFREE(char *) vcpus = NULL;
@@ -27772,7 +27772,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
unsigned int flags)
{
size_t i;
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
virBufferSetChildIndent(&childrenBuf, buf);
@@ -27960,9 +27960,9 @@ static int
virDomainIOMMUDefFormat(virBufferPtr buf,
const virDomainIOMMUDef *iommu)
{
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
virBufferSetChildIndent(&childBuf, buf);
@@ -28004,7 +28004,7 @@ static int
virDomainMemtuneFormat(virBufferPtr buf,
const virDomainMemtune *mem)
{
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
virBufferSetChildIndent(&childBuf, buf);
@@ -28066,9 +28066,9 @@ static int
virDomainVsockDefFormat(virBufferPtr buf,
virDomainVsockDefPtr vsock)
{
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) cidAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cidAttrBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
if (vsock->model) {
@@ -28104,7 +28104,7 @@ static int
virDomainDefFormatBlkiotune(virBufferPtr buf,
virDomainDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
ssize_t n;
virBufferSetChildIndent(&childrenBuf, buf);
@@ -28149,9 +28149,9 @@ static int
virDomainDefFormatFeatures(virBufferPtr buf,
virDomainDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) tmpAttrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) tmpChildBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) tmpAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) tmpChildBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
size_t i;
virBufferSetChildIndent(&childBuf, buf);
@@ -28998,7 +28998,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
virCapsPtr caps,
unsigned int flags)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int state;
int reason;
size_t i;
@@ -29979,7 +29979,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int flags = VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_SECURE;
int rc = -1;
char *netprefix;
@@ -30454,7 +30454,7 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
int *nparams,
int maxparams)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *data = NULL;
size_t i;
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 2680e88a60..9632604807 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -2373,7 +2373,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
static int
xenFormatSound(virConfPtr conf, virDomainDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char * model;
VIR_AUTOFREE(char *) str = NULL;
size_t i;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c2a19689c5..f4563eac37 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -209,7 +209,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
{
VIR_AUTOFREE(char *) alias = NULL;
VIR_AUTOFREE(char *) path = NULL;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
/* If the -object secret does not exist, then just return. This just
* means the domain won't be able to use a secret master key and is
@@ -730,7 +730,7 @@ static int
qemuBuildObjectSecretCommandLine(virCommandPtr cmd,
qemuDomainSecretInfoPtr secinfo)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
if (qemuBuildSecretInfoProps(secinfo, &props) < 0)
@@ -921,7 +921,7 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
const char *alias,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
if (qemuBuildTLSx509BackendProps(tlspath, isListen, verifypeer, alias,
@@ -962,7 +962,7 @@ static char *
qemuBuildNetworkDriveStr(virStorageSourcePtr src,
qemuDomainSecretInfoPtr secinfo)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
char *ret = NULL;
@@ -1786,7 +1786,7 @@ static char *
qemuBuildDriveStr(virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
int detect_zeroes = virDomainDiskGetDetectZeroesMode(disk->discard,
disk->detect_zeroes);
@@ -1951,7 +1951,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
unsigned int bootindex,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
const char *contAlias;
VIR_AUTOFREE(char *) backendAlias = NULL;
@@ -2293,7 +2293,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
char *
qemuBuildZPCIDevStr(virDomainDeviceInfoPtr dev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf,
"zpci,uid=%u,fid=%u,target=%s,id=zpci%u",
@@ -2345,7 +2345,7 @@ qemuBuildFloppyCommandLineControllerOptions(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps,
unsigned int bootFloppy)
{
- VIR_AUTOCLEAN(virBuffer) fdc_opts = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) fdc_opts = VIR_BUFFER_INITIALIZER;
bool explicitfdc = qemuDomainNeedsFDC(def);
bool hasfloppy = false;
unsigned int bootindex;
@@ -2422,7 +2422,7 @@ static int
qemuBuildObjectCommandline(virCommandPtr cmd,
virJSONValuePtr objProps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!objProps)
return 0;
@@ -2617,7 +2617,7 @@ qemuBuildDisksCommandLine(virCommandPtr cmd,
static char *
qemuBuildFSStr(virDomainFSDefPtr fs)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
const char *wrpolicy = virDomainFSWrpolicyTypeToString(fs->wrpolicy);
if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_PATH ||
@@ -2657,7 +2657,7 @@ qemuBuildFSDevStr(const virDomainDef *def,
virDomainFSDefPtr fs,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
if (qemuBuildVirtioDevStr(&opt, "virtio-9p", qemuCaps,
VIR_DOMAIN_DEVICE_FS, fs) < 0)
@@ -2864,7 +2864,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
virQEMUCapsPtr qemuCaps,
char **devstr)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
*devstr = NULL;
@@ -3643,7 +3643,7 @@ char *
qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
qemuDomainObjPrivatePtr priv)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *device;
if (!mem->info.alias) {
@@ -3729,7 +3729,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
size_t vhostfdSize,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
bool usingVirtio = false;
char macaddr[VIR_MAC_STRING_BUFLEN];
@@ -3903,7 +3903,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
const char *slirpfd)
{
bool is_tap = false;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainNetType netType = virDomainNetGetActualType(net);
size_t i;
@@ -4046,7 +4046,7 @@ qemuBuildWatchdogDevStr(const virDomainDef *def,
virDomainWatchdogDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *model = virDomainWatchdogModelTypeToString(dev->model);
if (!model) {
@@ -4114,7 +4114,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!virDomainDefHasMemballoon(def))
return 0;
@@ -4149,7 +4149,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
static char *
qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
dev->info.addr.spaprvio.has_reg) {
@@ -4205,7 +4205,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
virDomainInputDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
switch ((virDomainInputType)dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
@@ -4262,7 +4262,7 @@ qemuBuildUSBInputDevStr(const virDomainDef *def,
virDomainInputDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
switch (dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
@@ -4345,7 +4345,7 @@ qemuBuildSoundDevStr(const virDomainDef *def,
virDomainSoundDefPtr sound,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *model = NULL;
/* Hack for devices with different names in QEMU and libvirt */
@@ -4420,7 +4420,7 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound,
virDomainSoundCodecDefPtr codec,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *stype;
int type, flags;
@@ -4508,7 +4508,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
virDomainVideoDefPtr video,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *model = NULL;
/* We try to chose the best model for primary video device by preferring
@@ -4784,7 +4784,7 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
unsigned int bootIndex, /* used iff dev->info->bootIndex
== 0 */
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
int backend = pcisrc->backend;
@@ -4833,7 +4833,7 @@ qemuBuildUSBHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
if (!dev->missing && !usbsrc->bus && !usbsrc->device) {
@@ -4866,7 +4866,7 @@ qemuBuildHubDevStr(const virDomainDef *def,
virDomainHubDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (dev->type != VIR_DOMAIN_HUB_TYPE_USB) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -4931,7 +4931,7 @@ static char *
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) netsource = NULL;
VIR_AUTOPTR(virJSONValue) srcprops = NULL;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
@@ -4967,7 +4967,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
virQEMUCapsPtr qemuCaps,
char *vhostfdName)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_SCSI)) {
@@ -4999,7 +4999,7 @@ char *
qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) source = NULL;
VIR_AUTOFREE(char *) drivealias = NULL;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
@@ -5031,7 +5031,7 @@ char *
qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int model = -1;
VIR_AUTOFREE(char *) driveAlias = NULL;
const char *contAlias;
@@ -5228,7 +5228,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
unsigned int flags)
{
qemuDomainChrSourcePrivatePtr chrSourcePriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev);
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
bool telnet;
VIR_AUTOFREE(char *) charAlias = NULL;
@@ -5422,7 +5422,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev;
VIR_AUTOFREE(char *) mdevPath = NULL;
const char *dev_str = NULL;
@@ -5656,7 +5656,7 @@ static char *
qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
virDomainChrDefPtr dev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *contAlias;
switch (dev->deviceType) {
@@ -5719,7 +5719,7 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
static char *
qemuBuildSclpDevStr(virDomainChrDefPtr dev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) {
switch (dev->targetType) {
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
@@ -5841,7 +5841,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
virDomainRNGDefPtr dev,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!qemuDomainCheckCCWS390AddressSupport(def, &dev->info, qemuCaps,
dev->source.file))
@@ -5936,7 +5936,7 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager,
static char *
qemuBuildSmbiosBiosStr(virSysinfoBIOSDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!def)
return NULL;
@@ -5972,7 +5972,7 @@ static char *
qemuBuildSmbiosSystemStr(virSysinfoSystemDefPtr def,
bool skip_uuid)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!def ||
(!def->manufacturer && !def->product && !def->version
&&
@@ -6025,7 +6025,7 @@ qemuBuildSmbiosSystemStr(virSysinfoSystemDefPtr def,
static char *
qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!def)
return NULL;
@@ -6071,7 +6071,7 @@ qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPtr def)
static char *
qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
if (!def)
@@ -6091,7 +6091,7 @@ qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def)
static char *
qemuBuildSmbiosChassisStr(virSysinfoChassisDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!def)
return NULL;
@@ -6216,7 +6216,7 @@ qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) opts = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;
char guid[VIR_UUID_STRING_BUFLEN];
if (!def->genidRequested)
@@ -6266,7 +6266,7 @@ static char *
qemuBuildClockArgStr(virDomainClockDefPtr def)
{
size_t i;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
switch (def->offset) {
case VIR_DOMAIN_CLOCK_OFFSET_UTC:
@@ -6547,7 +6547,7 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) boot_buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) boot_buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) boot_opts_str = NULL;
if (def->os.bootmenu) {
@@ -6627,7 +6627,7 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
switch (iommu->model) {
case VIR_DOMAIN_IOMMU_MODEL_INTEL: {
- VIR_AUTOCLEAN(virBuffer) opts = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;
/* qemuDomainDeviceDefValidateIOMMU() already made sure we have
* one of QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU:
@@ -6841,8 +6841,8 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
virArch hostarch = virArchFromHost();
VIR_AUTOFREE(char *) cpu = NULL;
VIR_AUTOFREE(char *) cpu_flags = NULL;
- VIR_AUTOCLEAN(virBuffer) cpu_buf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cpu_buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
if (def->cpu &&
@@ -7119,7 +7119,7 @@ qemuBuildNameCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCommandAddArg(cmd, "-name");
@@ -7149,7 +7149,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virTristateSwitch vmport = def->features[VIR_DOMAIN_FEATURE_VMPORT];
virTristateSwitch smm = def->features[VIR_DOMAIN_FEATURE_SMM];
virCPUDefPtr cpu = def->cpu;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
/* This should *never* be NULL, since we always provide
@@ -7469,7 +7469,7 @@ static int
qemuBuildSmpCommandLine(virCommandPtr cmd,
virDomainDefPtr def)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
unsigned int maxvcpus = virDomainDefGetVcpusMax(def);
unsigned int nvcpus = 0;
virDomainVcpuDefPtr vcpu;
@@ -7630,7 +7630,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
{
size_t i, j;
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *cpumask = NULL;
char *tmpmask = NULL;
char *next = NULL;
@@ -7793,7 +7793,7 @@ qemuBuildMemoryDeviceCommandLine(virCommandPtr cmd,
/* memory hotplug requires NUMA to be enabled - we already checked
* that memory devices are present only when NUMA is */
for (i = 0; i < def->nmems; i++) {
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *dimmStr;
if (qemuBuildMemoryDimmBackendStr(&buf, def->mems[i], def, cfg, priv) <
0)
@@ -7820,7 +7820,7 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg
G_GNUC_UNUSED,
virQEMUCapsPtr qemuCaps G_GNUC_UNUSED,
virDomainGraphicsDefPtr graphics)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
if (graphics->data.sdl.xauth)
virCommandAddEnvPair(cmd, "XAUTHORITY", graphics->data.sdl.xauth);
@@ -7867,7 +7867,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
virQEMUCapsPtr qemuCaps,
virDomainGraphicsDefPtr graphics)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr glisten = NULL;
bool escapeAddr;
@@ -8000,7 +8000,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
virQEMUCapsPtr qemuCaps,
virDomainGraphicsDefPtr graphics)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr glisten = NULL;
int port = graphics->data.spice.port;
int tlsPort = graphics->data.spice.tlsPort;
@@ -8248,7 +8248,7 @@ qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg
G_GNUC_UNUSED
virQEMUCapsPtr qemuCaps,
virDomainGraphicsDefPtr graphics)
{
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
virBufferAddLit(&opt, "egl-headless");
@@ -8777,7 +8777,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
size_t i;
virDomainSmartcardDefPtr smartcard;
VIR_AUTOFREE(char *) devstr = NULL;
- VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
const char *database;
const char *contAlias = NULL;
unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
@@ -8886,7 +8886,7 @@ qemuBuildShmemDevLegacyStr(virDomainDefPtr def,
virDomainShmemDefPtr shmem,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -8929,7 +8929,7 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
virDomainShmemDefPtr shmem,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if ((shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN)) ||
@@ -9001,7 +9001,7 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
bool chardevStdioLogd)
{
VIR_AUTOPTR(virJSONValue) memProps = NULL;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) devstr = NULL;
VIR_AUTOFREE(char *) chardev = NULL;
int rc;
@@ -9426,7 +9426,7 @@ qemuBuildRedirdevDevStr(const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
size_t i;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainRedirFilterDefPtr redirfilter = def->redirfilter;
if (dev->bus != VIR_DOMAIN_REDIRDEV_BUS_USB) {
@@ -9544,7 +9544,7 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
virDomainDefPtr def)
{
virDomainLoaderDefPtr loader = def->os.loader;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int unit = 0;
if (!loader)
@@ -9601,7 +9601,7 @@ static char *
qemuBuildTPMDevStr(const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const virDomainTPMDef *tpm = def->tpm;
const char *model = virDomainTPMModelTypeToString(tpm->model);
virQEMUCapsFlags flag;
@@ -9670,7 +9670,7 @@ qemuBuildTPMBackendStr(const virDomainDef *def,
char **chardev)
{
const virDomainTPMDef *tpm = def->tpm;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) cancel_path = NULL;
VIR_AUTOFREE(char *) devset = NULL;
VIR_AUTOFREE(char *) cancelset = NULL;
@@ -9780,7 +9780,7 @@ static int
qemuBuildSEVCommandLine(virDomainObjPtr vm, virCommandPtr cmd,
virDomainSEVDefPtr sev)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
qemuDomainObjPrivatePtr priv = vm->privateData;
char *path = NULL;
@@ -9990,7 +9990,7 @@ qemuBuildManagedPRCommandLine(virCommandPtr cmd,
const virDomainDef *def,
qemuDomainObjPrivatePtr priv)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
if (!virDomainDefHasManagedPR(def))
@@ -10049,7 +10049,7 @@ qemuBuildDBusVMStateCommandLineEach(void *payload,
{
qemuBuildDBusVMStateCommandLineData *data = user_data;
qemuDBusVMStatePtr vms = payload;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
if (!(props = qemuBuildDBusVMStateInfoProps(id, vms->addr)))
@@ -10213,7 +10213,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
const char *fdprefix)
{
qemuDomainVsockPrivatePtr priv = (qemuDomainVsockPrivatePtr)vsock->privateData;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", qemuCaps,
VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) {
@@ -10548,7 +10548,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
virDomainChrDefPtr serial,
virQEMUCapsPtr qemuCaps)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virQEMUCapsFlags caps;
switch ((virDomainChrSerialTargetModel) serial->targetModel) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c638077aa8..734ea7a764 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2301,7 +2301,7 @@ static int
qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
virBufferPtr buf)
{
- VIR_AUTOCLEAN(virBuffer) tmp = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) tmp = VIR_BUFFER_INITIALIZER;
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
int ret = -1;
@@ -2447,8 +2447,8 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatSource(virBufferPtr buf,
virDomainXMLOptionPtr xmlopt,
bool chain)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
unsigned int xmlflags = VIR_DOMAIN_DEF_FORMAT_STATUS;
virBufferSetChildIndent(&childBuf, buf);
@@ -2476,9 +2476,9 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
const void *name G_GNUC_UNUSED,
void *opaque)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) chainsBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) chainsBuf = VIR_BUFFER_INITIALIZER;
qemuBlockJobDataPtr job = payload;
const char *state = qemuBlockjobStateTypeToString(job->state);
const char *newstate = NULL;
@@ -2571,8 +2571,8 @@ qemuDomainObjPrivateXMLFormatBlockjobs(virBufferPtr buf,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
bool bj = qemuDomainHasBlockjob(vm, false);
struct qemuDomainPrivateBlockJobFormatData iterdata = { priv->driver->xmlopt,
&childBuf };
@@ -2616,8 +2616,8 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
virStorageSourcePtr src,
virDomainXMLOptionPtr xmlopt)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
virBufferSetChildIndent(&childBuf, buf);
@@ -2645,8 +2645,8 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
size_t i;
virDomainDiskDefPtr disk;
qemuDomainDiskPrivatePtr diskPriv;
@@ -2683,8 +2683,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv)
{
- VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
qemuDomainJob job = priv->job.active;
int ret = -1;
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index aba2c359e7..6d3faadd23 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -290,7 +290,7 @@ qemuFirmwareInterfaceParse(const char *path,
{
virJSONValuePtr interfacesJSON;
VIR_AUTOPTR(qemuFirmwareOSInterface) interfaces = NULL;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t ninterfaces;
size_t i;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d3447dd2f3..242b637451 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -302,7 +302,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
{
int ret = -1;
qemuMonitorMessage msg;
- VIR_AUTOCLEAN(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
char *id = NULL;
*reply = NULL;
diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h
index 1c9748643e..0c074121bc 100644
--- a/src/util/virbuffer.h
+++ b/src/util/virbuffer.h
@@ -55,7 +55,7 @@ int virBufferCheckErrorInternal(const virBuffer *buf,
size_t linenr)
ATTRIBUTE_NONNULL(1);
-VIR_DEFINE_AUTOCLEAN_FUNC(virBuffer, virBufferFreeAndReset);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virBuffer, virBufferFreeAndReset);
/**
* virBufferCheckError
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 07b3e8823c..5e3c00a19c 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -2025,7 +2025,7 @@ char *
virJSONValueToString(virJSONValuePtr object,
bool pretty)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (virJSONValueToBuffer(object, &buf, pretty) < 0)
return NULL;
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index bb0579056e..2056eeb2e9 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -48,7 +48,7 @@ testBackingXMLjsonXML(const void *args)
const struct testBackingXMLjsonXMLdata *data = args;
VIR_AUTOPTR(xmlDoc) xml = NULL;
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) backendprops = NULL;
VIR_AUTOPTR(virJSONValue) wrapper = NULL;
VIR_AUTOFREE(char *) propsstr = NULL;
@@ -401,8 +401,8 @@ testQemuImageCreate(const void *opaque)
VIR_AUTOPTR(virJSONValue) protocolprops = NULL;
VIR_AUTOPTR(virJSONValue) formatprops = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL;
- VIR_AUTOCLEAN(virBuffer) debug = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) jsonprotocol = NULL;
VIR_AUTOFREE(char *) jsonformat = NULL;
VIR_AUTOFREE(char *) actual = NULL;
@@ -482,7 +482,7 @@ static int
testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
{
struct testQemuDiskXMLToJSONData *data = (void *) opaque;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) jsonpath = NULL;
VIR_AUTOFREE(char *) actual = NULL;
size_t i;
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 4dd7328028..52e4619f38 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -511,7 +511,7 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
const char *cmdname,
virJSONValuePtr args)
{
- VIR_AUTOCLEAN(virBuffer) debug = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
virJSONValuePtr schemaroot;
VIR_AUTOPTR(virJSONValue) emptyargs = NULL;
VIR_AUTOFREE(char *) schemapath = NULL;
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index f547afe7f7..385f016174 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -306,8 +306,8 @@ static int testBufAddBuffer(const void *data G_GNUC_UNUSED)
static int
testBufAddBuffer2(const void *opaque G_GNUC_UNUSED)
{
- VIR_AUTOCLEAN(virBuffer) buf1 = VIR_BUFFER_INITIALIZER;
- VIR_AUTOCLEAN(virBuffer) buf2 = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf1 = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf2 = VIR_BUFFER_INITIALIZER;
/* Intent of this test is to demonstrate a memleak that happen with
* virBufferAddBuffer */
@@ -461,7 +461,7 @@ testBufSetIndent(const void *opaque G_GNUC_UNUSED)
static int
testBufferAutoclean(const void *opaque G_GNUC_UNUSED)
{
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAddLit(&buf, "test test test\n");
return 0;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 20e407448f..af435189f1 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -610,7 +610,7 @@ static int
testBackingParse(const void *args)
{
const struct testBackingParseData *data = args;
- VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) xml = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL;
int rc;
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 8aaac097e9..109e0a5456 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -554,7 +554,7 @@ testActivation(bool useNames)
int *fds = NULL;
size_t nfds = 0;
VIR_AUTOPTR(virSystemdActivation) act = NULL;
- VIR_AUTOCLEAN(virBuffer) names = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) names = VIR_BUFFER_INITIALIZER;
virBufferAddLit(&names, "demo-unix.socket");
--
2.19.2