From 2b390b97b4ad946a6647e53819514c894d368344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 15 Oct 2019 14:47:50 +0200 Subject: [PATCH] Use g_autoptr instead of VIR_AUTOUNREF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that all the types using VIR_AUTOUNREF have a cleanup func defined to virObjectUnref, use g_autoptr instead of VIR_AUTOUNREF. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/conf/checkpoint_conf.c | 2 +- src/conf/domain_conf.c | 24 ++++++++++++------------ src/esx/esx_driver.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_blockjob.c | 14 +++++++------- src/qemu/qemu_checkpoint.c | 10 +++++----- src/qemu/qemu_command.c | 6 +++--- src/qemu/qemu_conf.c | 10 +++++----- src/qemu/qemu_domain.c | 14 +++++++------- src/qemu/qemu_driver.c | 24 ++++++++++++------------ src/qemu/qemu_firmware.c | 2 +- src/qemu/qemu_hotplug.c | 24 ++++++++++++------------ src/qemu/qemu_migration.c | 4 ++-- src/qemu/qemu_process.c | 4 ++-- src/qemu/qemu_slirp.c | 4 ++-- src/qemu/qemu_vhost_user_gpu.c | 6 +++--- src/storage/storage_backend_gluster.c | 2 +- src/storage/storage_util.c | 4 ++-- src/test/test_driver.c | 4 ++-- src/util/virhostdev.c | 18 +++++++++--------- src/util/virstoragefile.c | 20 ++++++++++---------- src/vbox/vbox_common.c | 4 ++-- src/vz/vz_driver.c | 2 +- tests/qemublocktest.c | 6 +++--- tests/qemudomaincheckpointxml2xmltest.c | 2 +- tests/qemudomainsnapshotxml2xmltest.c | 2 +- tests/qemusecuritytest.c | 4 ++-- tests/storagepoolcapstest.c | 6 +++--- tests/virstoragetest.c | 8 ++++---- 29 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 376a627ee4..e7b204a4d2 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -134,7 +134,7 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt, int n; char *tmp; g_autofree xmlNodePtr *nodes = NULL; - VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; + g_autoptr(virDomainCheckpointDef) def = NULL; if (!(def = virDomainCheckpointDefNew())) return NULL; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a0690e23f7..8616f820fc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1785,7 +1785,7 @@ static virDomainVcpuDefPtr virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt) { virDomainVcpuDefPtr ret = NULL; - VIR_AUTOUNREF(virObjectPtr) priv = NULL; + g_autoptr(virObject) priv = NULL; if (xmlopt && xmlopt->privateData.vcpuNew && !(priv = xmlopt->privateData.vcpuNew())) @@ -9276,7 +9276,7 @@ virDomainStorageSourceParseBase(const char *type, const char *format, const char *index) { - VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; + g_autoptr(virStorageSource) src = NULL; virStorageSourcePtr ret = NULL; if (!(src = virStorageSourceNew())) @@ -9402,7 +9402,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt); xmlNodePtr source; - VIR_AUTOUNREF(virStorageSourcePtr) backingStore = NULL; + g_autoptr(virStorageSource) backingStore = NULL; g_autofree char *type = NULL; g_autofree char *format = NULL; g_autofree char *idx = NULL; @@ -19526,7 +19526,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, int ret = -1; g_autoptr(virBitmap) vcpus = NULL; g_autofree xmlNodePtr *nodes = NULL; - VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL; + g_autoptr(virResctrlAlloc) alloc = NULL; ctxt->node = node; @@ -19724,7 +19724,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, virDomainResctrlDefPtr resctrl = NULL; g_autoptr(virBitmap) vcpus = NULL; g_autofree xmlNodePtr *nodes = NULL; - VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL; + g_autoptr(virResctrlAlloc) alloc = NULL; ssize_t i = 0; int n; @@ -30936,9 +30936,9 @@ virDomainNetCreatePort(virConnectPtr conn, unsigned int flags) { virErrorPtr save_err; - VIR_AUTOUNREF(virNetworkPtr) net = NULL; + g_autoptr(virNetwork) net = NULL; g_autoptr(virNetworkPortDef) portdef = NULL; - VIR_AUTOUNREF(virNetworkPortPtr) port = NULL; + g_autoptr(virNetworkPort) port = NULL; g_autofree char *portxml = NULL; if (!(net = virNetworkLookupByName(conn, iface->data.network.name))) @@ -31156,8 +31156,8 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface) virNetworkDefPtr def = NULL; int ret = -1; g_autofree char *xml = NULL; - VIR_AUTOUNREF(virConnectPtr) conn = NULL; - VIR_AUTOUNREF(virNetworkPtr) net = NULL; + g_autoptr(virConnect) conn = NULL; + g_autoptr(virNetwork) net = NULL; if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) return iface->type; @@ -31344,9 +31344,9 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def) virStorageVolInfo info; g_autoptr(virStoragePoolDef) pooldef = NULL; g_autofree char *poolxml = NULL; - VIR_AUTOUNREF(virConnectPtr) conn = NULL; - VIR_AUTOUNREF(virStoragePoolPtr) pool = NULL; - VIR_AUTOUNREF(virStorageVolPtr) vol = NULL; + g_autoptr(virConnect) conn = NULL; + g_autoptr(virStoragePool) pool = NULL; + g_autoptr(virStorageVol) vol = NULL; if (def->src->type != VIR_STORAGE_TYPE_VOLUME) return 0; diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index b7c80d5c43..cdf925d62c 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -4100,7 +4100,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, virDomainSnapshotPtr snapshot = NULL; bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0; bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; unsigned int parse_flags = 0; /* ESX supports disk-only and quiesced snapshots; libvirt tracks no diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 631cfc9a49..64b21f2073 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6539,7 +6539,7 @@ libxlDomainSetMetadata(virDomainPtr dom, unsigned int flags) { libxlDriverPrivatePtr driver = dom->conn->privateData; - VIR_AUTOUNREF(libxlDriverConfigPtr) cfg = libxlDriverConfigGet(driver); + g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver); virDomainObjPtr vm = NULL; int ret = -1; diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 239bf772d5..cda31f8719 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -103,7 +103,7 @@ qemuBlockJobDataPtr qemuBlockJobDataNew(qemuBlockJobType type, const char *name) { - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; if (qemuBlockJobDataInitialize() < 0) return NULL; @@ -206,7 +206,7 @@ qemuBlockJobDiskNew(virDomainObjPtr vm, qemuBlockJobType type, const char *jobname) { - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; if (!(job = qemuBlockJobDataNew(type, jobname))) return NULL; @@ -224,7 +224,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm, virStorageSourcePtr base) { qemuDomainObjPrivatePtr priv = vm->privateData; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; g_autofree char *jobname = NULL; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { @@ -255,7 +255,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virStorageSourcePtr base) { qemuDomainObjPrivatePtr priv = vm->privateData; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; g_autofree char *jobname = NULL; qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT; @@ -290,7 +290,7 @@ qemuBlockJobNewCreate(virDomainObjPtr vm, virStorageSourcePtr chain, bool storage) { - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; g_autofree char *jobname = NULL; const char *nodename = src->nodeformat; @@ -323,7 +323,7 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, bool reuse) { qemuDomainObjPrivatePtr priv = vm->privateData; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; g_autofree char *jobname = NULL; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { @@ -595,7 +595,7 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm, virStorageSourcePtr newsrc) { virDomainDiskDefPtr persistDisk = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) copy = NULL; + g_autoptr(virStorageSource) copy = NULL; virStorageSourcePtr n; if (!vm->newDef) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 7f675d4b79..4b4ad8bb83 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -118,7 +118,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, virDomainMomentObjPtr moment; virDomainCheckpointDefPtr parentdef = NULL; size_t i, j; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autofree char *chkFile = NULL; if (!metadata_only && !virDomainObjIsActive(vm)) { @@ -354,11 +354,11 @@ qemuCheckpointCreateXML(virDomainPtr domain, bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; unsigned int parse_flags = 0; virDomainMomentObjPtr other = NULL; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; - VIR_AUTOUNREF(virCapsPtr) caps = NULL; + g_autoptr(virQEMUDriverConfig) cfg = NULL; + g_autoptr(virCaps) caps = NULL; g_autoptr(virJSONValue) actions = NULL; int ret; - VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; + g_autoptr(virDomainCheckpointDef) def = NULL; virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE, NULL); @@ -532,7 +532,7 @@ qemuCheckpointDelete(virDomainObjPtr vm, { qemuDomainObjPrivatePtr priv = vm->privateData; virQEMUDriverPtr driver = priv->driver; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); int ret = -1; virDomainMomentObjPtr chk = NULL; virQEMUMomentRemove rem; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6829bede99..d5f29ba5d4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6753,7 +6753,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, virQEMUCapsPtr qemuCaps) { size_t i; - VIR_AUTOUNREF(virCapsPtr) caps = NULL; + g_autoptr(virCaps) caps = NULL; virCPUDefPtr cpu = def->cpu; if (!(caps = virQEMUDriverGetCapabilities(driver, false))) @@ -8337,7 +8337,7 @@ qemuInterfaceVhostuserConnect(virQEMUDriverPtr driver, virQEMUCapsPtr qemuCaps, char **chardev) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); switch ((virDomainChrType)net->data.vhostuser->type) { case VIR_DOMAIN_CHR_TYPE_UNIX: @@ -10277,7 +10277,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, size_t i; char uuid[VIR_UUID_STRING_BUFLEN]; g_autoptr(virCommand) cmd = NULL; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); unsigned int bootHostdevNet = 0; qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr def = vm->def; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 630e31723a..10d06d7e1c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -105,7 +105,7 @@ qemuDriverUnlock(virQEMUDriverPtr driver) virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; + g_autoptr(virQEMUDriverConfig) cfg = NULL; if (virQEMUConfigInitialize() < 0) return NULL; @@ -1243,7 +1243,7 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver) virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver) { size_t i, j; - VIR_AUTOUNREF(virCapsPtr) caps = NULL; + g_autoptr(virCaps) caps = NULL; g_autofree virSecurityManagerPtr *sec_managers = NULL; /* Security driver data */ const char *doi, *model, *lbl, *type; @@ -1379,9 +1379,9 @@ virQEMUDriverGetDomainCapabilities(virQEMUDriverPtr driver, virArch arch, virDomainVirtType virttype) { - VIR_AUTOUNREF(virDomainCapsPtr) domCaps = NULL; - VIR_AUTOUNREF(virCapsPtr) caps = NULL; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virDomainCaps) domCaps = NULL; + g_autoptr(virCaps) caps = NULL; + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virHashTablePtr domCapsCache = virQEMUCapsGetDomainCapsCache(qemuCaps); struct virQEMUDriverSearchDomcapsData data = { .path = virQEMUCapsGetBinary(qemuCaps), diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e25f5a7ee8..1bda2f5159 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3015,7 +3015,7 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node, g_autofree char *format = NULL; g_autofree char *type = NULL; g_autofree char *index = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; + g_autoptr(virStorageSource) src = NULL; xmlNodePtr sourceNode; unsigned int xmlflags = VIR_DOMAIN_DEF_PARSE_STATUS; @@ -3161,7 +3161,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, { VIR_XPATH_NODE_AUTORESTORE(ctxt); virDomainDiskDefPtr disk = NULL; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; g_autofree char *name = NULL; g_autofree char *typestr = NULL; int type; @@ -3313,7 +3313,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node, qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); g_autofree char *format = NULL; g_autofree char *type = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) migrSource = NULL; + g_autoptr(virStorageSource) migrSource = NULL; xmlNodePtr sourceNode; ctxt->node = node; @@ -8083,7 +8083,7 @@ void qemuDomainSaveConfig(virDomainObjPtr obj) { virQEMUDriverPtr driver = QEMU_DOMAIN_PRIVATE(obj)->driver; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; + g_autoptr(virQEMUDriverConfig) cfg = NULL; virDomainDefPtr def = NULL; if (virDomainObjIsActive(obj)) @@ -8911,7 +8911,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, def->cpu && (def->cpu->mode != VIR_CPU_MODE_CUSTOM || def->cpu->model)) { - VIR_AUTOUNREF(virQEMUCapsPtr) qCaps = NULL; + g_autoptr(virQEMUCaps) qCaps = NULL; if (qemuCaps) { qCaps = virObjectRef(qemuCaps); @@ -10263,7 +10263,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, virStorageSourcePtr disksrc, bool report_broken) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virStorageSourcePtr src; /* iterator for the backing chain declared in XML */ virStorageSourcePtr n; /* iterator for the backing chain detected from disk */ qemuDomainObjPrivatePtr priv = vm->privateData; @@ -10442,7 +10442,7 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver, virStorageSourcePtr src, qemuDomainStorageSourceAccessFlags flags) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); const char *srcstr = NULLSTR(src->path); int ret = -1; virErrorPtr orig_err = NULL; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index beb72f21d1..86d7647628 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -255,7 +255,7 @@ qemuSecurityChownCallback(const virStorageSource *src, int save_errno = 0; int ret = -1; int rv; - VIR_AUTOUNREF(virStorageSourcePtr) cpy = NULL; + g_autoptr(virStorageSource) cpy = NULL; rv = virStorageFileSupportsSecurityDriver(src); if (rv <= 0) @@ -4804,7 +4804,7 @@ processBlockJobEvent(virQEMUDriverPtr driver, int status) { virDomainDiskDefPtr disk; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) return; @@ -13695,7 +13695,7 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, { int ret = VIR_CPU_COMPARE_ERROR; virQEMUDriverPtr driver = conn->privateData; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virQEMUCapsPtr qemuCaps = NULL; bool failIncompatible; virCPUDefPtr hvCPU; @@ -13908,7 +13908,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, unsigned int flags) { virQEMUDriverPtr driver = conn->privateData; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virCPUDefPtr *cpus = NULL; virQEMUCapsPtr qemuCaps = NULL; virArch arch; @@ -15458,7 +15458,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; char *backingStoreStr; virDomainDiskDefPtr persistdisk; - VIR_AUTOUNREF(virStorageSourcePtr) terminator = NULL; + g_autoptr(virStorageSource) terminator = NULL; bool supportsCreate; bool supportsBacking; int rc; @@ -15968,7 +15968,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, virCapsPtr caps = NULL; qemuDomainObjPrivatePtr priv; virDomainSnapshotState state; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | @@ -17970,7 +17970,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, virDomainDiskDefPtr disk; int ret = -1; qemuMonitorBlockJobInfo rawInfo; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1); @@ -18214,13 +18214,13 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, virDomainDiskDefPtr disk = NULL; int ret = -1; bool need_unlink = false; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); const char *format = NULL; bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); bool mirror_shallow = !!(flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW); bool existing = mirror_reuse; qemuBlockJobDataPtr job = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) mirror = mirrorsrc; + g_autoptr(virStorageSource) mirror = mirrorsrc; bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool mirror_initialized = false; g_autoptr(qemuBlockStorageSourceChainData) data = NULL; @@ -18493,7 +18493,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base, virDomainObjPtr vm; int ret = -1; unsigned long long speed = bandwidth; - VIR_AUTOUNREF(virStorageSourcePtr) dest = NULL; + g_autoptr(virStorageSource) dest = NULL; virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT | @@ -18698,7 +18698,7 @@ qemuDomainBlockCommit(virDomainPtr dom, g_autofree char *backingPath = NULL; unsigned long long speed = bandwidth; qemuBlockJobDataPtr job = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) mirror = NULL; + g_autoptr(virStorageSource) mirror = NULL; const char *nodetop = NULL; const char *nodebase = NULL; bool persistjob = false; @@ -20693,7 +20693,7 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver, virDomainResctrlDefPtr resctrl = NULL; virQEMUResctrlMonDataPtr res = NULL; char **features = NULL; - VIR_AUTOUNREF(virCapsPtr) caps = NULL; + g_autoptr(virCaps) caps = NULL; size_t i = 0; size_t j = 0; diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index b8a17ed1ca..313c909aed 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1028,7 +1028,7 @@ qemuFirmwareEnableFeatures(virQEMUDriverPtr driver, virDomainDefPtr def, const qemuFirmware *fw) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); const qemuFirmwareMappingFlash *flash = &fw->mapping.data.flash; const qemuFirmwareMappingKernel *kernel = &fw->mapping.data.kernel; const qemuFirmwareMappingMemory *memory = &fw->mapping.data.memory; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7b3363c0c7..df6f3f9b55 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -584,7 +584,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, virStorageSourcePtr newsrc, bool force) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv = vm->privateData; virStorageSourcePtr oldsrc = disk->src; qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); @@ -676,7 +676,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; g_autofree char *devstr = NULL; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virJSONValue) corProps = NULL; g_autofree char *corAlias = NULL; bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); @@ -1147,7 +1147,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, bool iface_connected = false; virDomainNetType actualType; virNetDevBandwidthPtr actualBandwidth; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virDomainCCWAddressSetPtr ccwaddrs = NULL; size_t i; g_autofree char *charDevAlias = NULL; @@ -1543,7 +1543,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, bool teardowndevice = false; bool teardownmemlock = false; int backend; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); unsigned int flags = 0; if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) @@ -1767,7 +1767,7 @@ qemuDomainAddChardevTLSObjects(virQEMUDriverPtr driver, const char **secAlias) { int ret = -1; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainChrSourcePrivatePtr chrSourcePriv; qemuDomainSecretInfoPtr secinfo = NULL; @@ -1823,7 +1823,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver, virDomainChrSourceDefPtr dev, const char *inAlias) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv = vm->privateData; g_autofree char *tlsAlias = NULL; g_autofree char *secAlias = NULL; @@ -2333,7 +2333,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, { qemuDomainObjPrivatePtr priv = vm->privateData; virErrorPtr orig_err; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def); unsigned long long newmem = oldmem + mem->size; g_autofree char *devstr = NULL; @@ -3301,7 +3301,7 @@ qemuDomainAttachLease(virQEMUDriverPtr driver, virDomainLeaseDefPtr lease) { int ret = -1; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); if (virDomainLeaseInsertPreAlloc(vm->def) < 0) goto cleanup; @@ -4012,7 +4012,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, virDomainGraphicsDefPtr dev) { virDomainGraphicsDefPtr olddev = qemuDomainFindGraphics(vm, dev); - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); const char *type = virDomainGraphicsTypeToString(dev->type); size_t i; int ret = -1; @@ -4555,7 +4555,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainNetDefPtr net) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv = vm->privateData; g_autofree char *hostnet_name = NULL; g_autofree char *charDevAlias = NULL; @@ -6306,7 +6306,7 @@ qemuDomainSetVcpusInternal(virQEMUDriverPtr driver, unsigned int nvcpus, bool hotpluggable) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virBitmapPtr vcpumap = NULL; bool enable; int ret = -1; @@ -6501,7 +6501,7 @@ qemuDomainSetVcpuInternal(virQEMUDriverPtr driver, virBitmapPtr map, bool state) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virBitmapPtr livevcpus = NULL; int ret = -1; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1166236124..b34e47e473 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -797,7 +797,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); int mon_ret = 0; - VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL; + g_autoptr(virStorageSource) copysrc = NULL; VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host); @@ -991,7 +991,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver, unsigned long long mirror_speed = speed; bool mirror_shallow = *migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC; int rv; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d21d95a977..b2d07cf279 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -936,7 +936,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon G_GNUC_UNUSED, virQEMUDriverPtr driver = opaque; struct qemuProcessEvent *processEvent = NULL; virDomainDiskDefPtr disk; - VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; + g_autoptr(qemuBlockJobData) job = NULL; char *data = NULL; virObjectLock(vm); @@ -5537,7 +5537,7 @@ static int qemuProcessStartUpdateCustomCaps(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(priv->driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver); qemuDomainXmlNsDefPtr nsdef = vm->def->namespaceData; char **next; int tmp; diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index b4d85c49df..6e6393f49d 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -240,7 +240,7 @@ qemuSlirpStop(qemuSlirpPtr slirp, virDomainNetDefPtr net, bool hot) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autofree char *pidfile = NULL; g_autofree char *dbus_path = NULL; g_autofree char *id = qemuSlirpGetDBusVMStateId(net); @@ -296,7 +296,7 @@ qemuSlirpStart(qemuSlirpPtr slirp, bool hotplug, bool incoming) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virCommand) cmd = NULL; g_autofree char *pidfile = NULL; g_autofree char *dbus_path = NULL; diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c index 6daccf170e..49f48c6d08 100644 --- a/src/qemu/qemu_vhost_user_gpu.c +++ b/src/qemu/qemu_vhost_user_gpu.c @@ -105,7 +105,7 @@ int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainVideoDefPtr video) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autofree char *shortname = NULL; g_autofree char *pidfile = NULL; g_autoptr(virCommand) cmd = NULL; @@ -209,7 +209,7 @@ void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainVideoDefPtr video) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autofree char *pidfile = NULL; g_autofree char *shortname = NULL; virErrorPtr orig_err; @@ -252,7 +252,7 @@ qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver, virDomainVideoDefPtr video, virCgroupPtr cgroup) { - VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autofree char *shortname = NULL; int rc; pid_t pid; diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 07aca084d8..1b87e800ac 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -239,7 +239,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, ssize_t len; int backingFormat; g_autoptr(virStorageVolDef) vol = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; + g_autoptr(virStorageSource) meta = NULL; g_autofree char *header = NULL; *volptr = NULL; diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index c51494045d..e97bd2151a 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3359,7 +3359,7 @@ storageBackendProbeTarget(virStorageSourcePtr target, int backingStoreFormat; int rc; struct stat sb; - VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; + g_autoptr(virStorageSource) meta = NULL; VIR_AUTOCLOSE fd = -1; if (encryption) @@ -3529,7 +3529,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool) int ret = -1; g_autoptr(virStorageVolDef) vol = NULL; VIR_AUTOCLOSE fd = -1; - VIR_AUTOUNREF(virStorageSourcePtr) target = NULL; + g_autoptr(virStorageSource) target = NULL; if (virDirOpen(&dir, def->target.path) < 0) goto cleanup; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 8c77ec6e0d..42bb3d19f0 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -8558,7 +8558,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain, bool update_current = true; bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE; unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; /* * DISK_ONLY: Not implemented yet @@ -9042,7 +9042,7 @@ testDomainCheckpointCreateXML(virDomainPtr domain, bool update_current = true; bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; unsigned int parse_flags = 0; - VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; + g_autoptr(virDomainCheckpointDef) def = NULL; virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE | VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE, NULL); diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index dbc235d6f1..5ceadc6026 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -144,7 +144,7 @@ virHostdevManagerDispose(void *obj) static virHostdevManagerPtr virHostdevManagerNew(void) { - VIR_AUTOUNREF(virHostdevManagerPtr) hostdevMgr = NULL; + g_autoptr(virHostdevManager) hostdevMgr = NULL; bool privileged = geteuid() == 0; if (!(hostdevMgr = virObjectNew(virHostdevManagerClass))) @@ -264,7 +264,7 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev, static virPCIDeviceListPtr virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) { - VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; + g_autoptr(virPCIDeviceList) pcidevs = NULL; size_t i; if (!(pcidevs = virPCIDeviceListNew())) @@ -713,7 +713,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, int nhostdevs, unsigned int flags) { - VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; + g_autoptr(virPCIDeviceList) pcidevs = NULL; int last_processed_hostdev_vf = -1; size_t i; int ret = -1; @@ -985,7 +985,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr, int nhostdevs, const char *oldStateDir) { - VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; + g_autoptr(virPCIDeviceList) pcidevs = NULL; size_t i; if (!nhostdevs) @@ -1386,7 +1386,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev, * automatically found before. */ if (vendor) { - VIR_AUTOUNREF(virUSBDeviceListPtr) devs = NULL; + g_autoptr(virUSBDeviceList) devs = NULL; rc = virUSBDeviceFindByVendor(vendor, product, NULL, mandatory, &devs); if (rc < 0) { @@ -1442,7 +1442,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr mgr, unsigned int flags) { size_t i; - VIR_AUTOUNREF(virUSBDeviceListPtr) list = NULL; + g_autoptr(virUSBDeviceList) list = NULL; virUSBDevicePtr tmp; bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT); @@ -1537,7 +1537,7 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr mgr, { size_t i, j; int count; - VIR_AUTOUNREF(virSCSIDeviceListPtr) list = NULL; + g_autoptr(virSCSIDeviceList) list = NULL; virSCSIDevicePtr tmp; if (!nhostdevs) @@ -1632,7 +1632,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr mgr, virDomainHostdevDefPtr *hostdevs, int nhostdevs) { - VIR_AUTOUNREF(virSCSIVHostDeviceListPtr) list = NULL; + g_autoptr(virSCSIVHostDeviceList) list = NULL; virSCSIVHostDevicePtr tmp; size_t i, j; @@ -1718,7 +1718,7 @@ virHostdevPrepareMediatedDevices(virHostdevManagerPtr mgr, int nhostdevs) { size_t i; - VIR_AUTOUNREF(virMediatedDeviceListPtr) list = NULL; + g_autoptr(virMediatedDeviceList) list = NULL; if (!nhostdevs) return 0; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 51d80b1cb8..ac0c70b21e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1129,7 +1129,7 @@ static virStorageSourcePtr virStorageFileMetadataNew(const char *path, int format) { - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; virStorageSourcePtr ret = NULL; if (!(def = virStorageSourceNew())) @@ -1219,7 +1219,7 @@ virStorageFileGetMetadataFromFD(const char *path, struct stat sb; int dummy; g_autofree char *buf = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; + g_autoptr(virStorageSource) meta = NULL; if (!backingFormat) backingFormat = &dummy; @@ -2251,7 +2251,7 @@ virStorageSourceCopy(const virStorageSource *src, bool backingChain) { virStorageSourcePtr ret = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; if (!(def = virStorageSourceNew())) return NULL; @@ -2629,7 +2629,7 @@ virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent, { virStorageSourcePtr ret = NULL; g_autofree char *dirname = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; if (!(def = virStorageSourceNew())) return NULL; @@ -3681,7 +3681,7 @@ virStorageSourceNewFromBackingAbsolute(const char *path, { const char *json; int rc = 0; - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; *src = NULL; @@ -3748,7 +3748,7 @@ virStorageSourceNewFromChild(virStorageSourcePtr parent, virStorageSourcePtr *child) { struct stat st; - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; int rc = 0; *child = NULL; @@ -3948,7 +3948,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src, bool probe) { int format = src->format; - VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; + g_autoptr(virStorageSource) meta = NULL; /* Raw files: capacity is physical size. For all other files: if * the metadata has a capacity, use that, otherwise fall back to @@ -4943,7 +4943,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, int backingFormat; int rv; g_autofree char *buf = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) backingStore = NULL; + g_autoptr(virStorageSource) backingStore = NULL; VIR_DEBUG("path=%s format=%d uid=%u gid=%u", src->path, src->format, @@ -5028,7 +5028,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, VIR_STEAL_PTR(src->backingStore, backingStore); if (src->externalDataStoreRaw) { - VIR_AUTOUNREF(virStorageSourcePtr) externalDataStore = NULL; + g_autoptr(virStorageSource) externalDataStore = NULL; if ((rv = virStorageSourceNewFromExternalData(src, &externalDataStore)) < 0) @@ -5121,7 +5121,7 @@ virStorageFileGetBackingStoreStr(virStorageSourcePtr src, ssize_t headerLen; int rv; g_autofree char *buf = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) tmp = NULL; + g_autoptr(virStorageSource) tmp = NULL; *backing = NULL; diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 50c7de3e02..7fa9a98a1e 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -5477,7 +5477,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, virDomainSnapshotPtr ret = NULL; unsigned int parse_flags = (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS | VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE); - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; if (!data->vboxObj) return ret; @@ -6199,7 +6199,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, char uuidstr[VIR_UUID_STRING_BUFLEN]; char *ret = NULL; virDomainDefPtr defdom; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; if (!data->vboxObj) return ret; diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 917acdae57..fe46d6349e 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -2595,7 +2595,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain, virDomainSnapshotObjListPtr snapshots = NULL; virDomainMomentObjPtr current; bool job = false; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3bf1271b3e..6d90e2faf5 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -54,8 +54,8 @@ testBackingXMLjsonXML(const void *args) g_autofree char *propsstr = NULL; g_autofree char *protocolwrapper = NULL; g_autofree char *actualxml = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc = NULL; + g_autoptr(virStorageSource) xmlsrc = NULL; + g_autoptr(virStorageSource) jsonsrc = NULL; if (!(xmlsrc = virStorageSourceNew())) return -1; @@ -400,7 +400,7 @@ testQemuImageCreate(const void *opaque) struct testQemuImageCreateData *data = (void *) opaque; g_autoptr(virJSONValue) protocolprops = NULL; g_autoptr(virJSONValue) formatprops = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; + g_autoptr(virStorageSource) src = NULL; g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER; g_autofree char *jsonprotocol = NULL; diff --git a/tests/qemudomaincheckpointxml2xmltest.c b/tests/qemudomaincheckpointxml2xmltest.c index 72d1eeaea5..f6eb1f69b2 100644 --- a/tests/qemudomaincheckpointxml2xmltest.c +++ b/tests/qemudomaincheckpointxml2xmltest.c @@ -41,7 +41,7 @@ testCompareXMLToXMLFiles(const char *inxml, g_autofree char *inXmlData = NULL; g_autofree char *outXmlData = NULL; g_autofree char *actual = NULL; - VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; + g_autoptr(virDomainCheckpointDef) def = NULL; if (flags & TEST_REDEFINE) parseflags |= VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE; diff --git a/tests/qemudomainsnapshotxml2xmltest.c b/tests/qemudomainsnapshotxml2xmltest.c index c84ee0bf7d..66cb124f09 100644 --- a/tests/qemudomainsnapshotxml2xmltest.c +++ b/tests/qemudomainsnapshotxml2xmltest.c @@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *inxml, unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE; bool cur = false; - VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; + g_autoptr(virDomainSnapshotDef) def = NULL; if (flags & TEST_INTERNAL) { parseflags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL; diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c index 83719a28f2..288718c2a5 100644 --- a/tests/qemusecuritytest.c +++ b/tests/qemusecuritytest.c @@ -40,7 +40,7 @@ prepareObjects(virQEMUDriverPtr driver, virDomainObjPtr *vm_ret) { qemuDomainObjPrivatePtr priv; - VIR_AUTOUNREF(virDomainObjPtr) vm = NULL; + g_autoptr(virDomainObj) vm = NULL; g_autofree char *filename = NULL; g_autofree char *domxml = NULL; g_autofree char *latestCapsFile = NULL; @@ -84,7 +84,7 @@ static int testDomain(const void *opaque) { const struct testData *data = opaque; - VIR_AUTOUNREF(virDomainObjPtr) vm = NULL; + g_autoptr(virDomainObj) vm = NULL; VIR_AUTOSTRINGLIST notRestored = NULL; size_t i; int ret = -1; diff --git a/tests/storagepoolcapstest.c b/tests/storagepoolcapstest.c index 185372e939..6b0680291e 100644 --- a/tests/storagepoolcapstest.c +++ b/tests/storagepoolcapstest.c @@ -54,7 +54,7 @@ test_virStoragePoolCapsFormat(const void *opaque) struct test_virStoragePoolCapsFormatData *data = (struct test_virStoragePoolCapsFormatData *) opaque; virCapsPtr driverCaps = data->driverCaps; - VIR_AUTOUNREF(virStoragePoolCapsPtr) poolCaps = NULL; + g_autoptr(virStoragePoolCaps) poolCaps = NULL; g_autofree char *path = NULL; g_autofree char *poolCapsXML = NULL; @@ -81,8 +81,8 @@ static int mymain(void) { int ret = 0; - VIR_AUTOUNREF(virCapsPtr) fullCaps = NULL; - VIR_AUTOUNREF(virCapsPtr) fsCaps = NULL; + g_autoptr(virCaps) fullCaps = NULL; + g_autoptr(virCaps) fsCaps = NULL; #define DO_TEST(Filename, DriverCaps) \ do { \ diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 6cec458088..33ef662115 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -86,7 +86,7 @@ testStorageFileGetMetadata(const char *path, { struct stat st; virStorageSourcePtr ret = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; + g_autoptr(virStorageSource) def = NULL; if (!(def = virStorageSourceNew())) return NULL; @@ -278,7 +278,7 @@ testStorageChain(const void *args) const struct testChainData *data = args; virStorageSourcePtr elt; size_t i = 0; - VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; + g_autoptr(virStorageSource) meta = NULL; g_autofree char *broken = NULL; meta = testStorageFileGetMetadata(data->start, data->format, -1, -1); @@ -612,7 +612,7 @@ testBackingParse(const void *args) const struct testBackingParseData *data = args; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_autofree char *xml = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; + g_autoptr(virStorageSource) src = NULL; int rc; int erc = data->rv; @@ -664,7 +664,7 @@ mymain(void) virStorageSourcePtr chain2; /* short for chain->backingStore */ virStorageSourcePtr chain3; /* short for chain2->backingStore */ g_autoptr(virCommand) cmd = NULL; - VIR_AUTOUNREF(virStorageSourcePtr) chain = NULL; + g_autoptr(virStorageSource) chain = NULL; if (storageRegisterAll() < 0) return EXIT_FAILURE;