Prefer: return g_steal_pointer(&ptr); Signed-off-by: Ján Tomko <jto...@redhat.com> --- src/conf/domain_conf.c | 8 ++++---- src/conf/secret_conf.c | 2 +- src/conf/storage_conf.c | 2 +- src/conf/virnetworkportdef.c | 2 +- src/libxl/xen_xl.c | 2 +- src/libxl/xen_xm.c | 2 +- src/qemu/qemu_block.c | 30 +++++++++++++++--------------- src/qemu/qemu_blockjob.c | 12 ++++++------ src/qemu/qemu_command.c | 10 +++++----- src/qemu/qemu_conf.c | 6 +++--- src/qemu/qemu_dbus.c | 2 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_interface.c | 2 +- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_qapi.c | 2 +- src/qemu/qemu_slirp.c | 4 ++-- src/util/virhostdev.c | 4 ++-- src/util/virpci.c | 2 +- tools/virsh-completer.c | 2 +- 19 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8616f820fc..8b56ff3458 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16560,7 +16560,7 @@ virDomainDeviceDefParse(const char *xmlStr, if (virDomainDeviceDefValidate(dev, def, flags, xmlopt) < 0) return NULL; - VIR_RETURN_PTR(dev); + return g_steal_pointer(&dev); } @@ -21681,7 +21681,7 @@ virDomainDefParseNode(xmlDocPtr xml, if (virDomainDefValidate(def, caps, flags, xmlopt) < 0) return NULL; - VIR_RETURN_PTR(def); + return g_steal_pointer(&def); } @@ -30672,7 +30672,7 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom, port->trustGuestRxFilters = iface->trustGuestRxFilters; - VIR_RETURN_PTR(port); + return g_steal_pointer(&port); } int @@ -30925,7 +30925,7 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom, port->class_id = actual->class_id; port->trustGuestRxFilters = actual->trustGuestRxFilters; - VIR_RETURN_PTR(port); + return g_steal_pointer(&port); } diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c index 6ee9315933..3716d5731f 100644 --- a/src/conf/secret_conf.c +++ b/src/conf/secret_conf.c @@ -193,7 +193,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) && virSecretDefParseUsage(ctxt, def) < 0) return NULL; - VIR_RETURN_PTR(def); + return g_steal_pointer(&def); } static virSecretDefPtr diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 4c7e7b3f4d..bddede0934 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -718,7 +718,7 @@ virStoragePoolDefParseSourceString(const char *srcSpec, node) < 0) return NULL; - VIR_RETURN_PTR(def); + return g_steal_pointer(&def); } diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 32834e41d4..459384611c 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -253,7 +253,7 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt) return NULL; } - VIR_RETURN_PTR(def); + return g_steal_pointer(&def); } diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 8ae0dbbbd5..cbd3364fe9 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -2247,5 +2247,5 @@ xenFormatXL(virDomainDefPtr def, virConnectPtr conn) if (xenFormatXLDomainChannels(conf, def) < 0) return NULL; - VIR_RETURN_PTR(conf); + return g_steal_pointer(&conf); } diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c index 65882b7c0b..e368482cac 100644 --- a/src/libxl/xen_xm.c +++ b/src/libxl/xen_xm.c @@ -616,5 +616,5 @@ xenFormatXM(virConnectPtr conn, if (xenFormatXMInputDevs(conf, def) < 0) return NULL; - VIR_RETURN_PTR(conf); + return g_steal_pointer(&conf); } diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 46584f2f1b..8841006c96 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -255,7 +255,7 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodes, &data) < 0) return NULL; - VIR_RETURN_PTR(disks); + return g_steal_pointer(&disks); } @@ -380,7 +380,7 @@ qemuBlockGetNodeData(virJSONValuePtr data) qemuBlockNamedNodesArrayToHash, nodedata) < 0) return NULL; - VIR_RETURN_PTR(nodedata); + return g_steal_pointer(&nodedata); } @@ -449,7 +449,7 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) if (VIR_STRDUP(uri->server, src->hosts->name) < 0) return NULL; - VIR_RETURN_PTR(uri); + return g_steal_pointer(&uri); } @@ -514,7 +514,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host, return NULL; } - VIR_RETURN_PTR(server); + return g_steal_pointer(&server); } @@ -550,7 +550,7 @@ qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSourcePtr src, server = NULL; } - VIR_RETURN_PTR(servers); + return g_steal_pointer(&servers); } @@ -617,7 +617,7 @@ qemuBlockStorageSourceBuildHostsJSONInetSocketAddress(virStorageSourcePtr src) server = NULL; } - VIR_RETURN_PTR(servers); + return g_steal_pointer(&servers); } @@ -649,7 +649,7 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src, virJSONValueObjectAdd(props, "u:debug", src->debugLevel, NULL) < 0) return NULL; - VIR_RETURN_PTR(props); + return g_steal_pointer(&props); } @@ -989,7 +989,7 @@ qemuBlockStorageSourceGetVvfatProps(virStorageSourcePtr src, virJSONValueObjectAdd(ret, "b:rw", !src->readonly, NULL) < 0) return NULL; - VIR_RETURN_PTR(ret); + return g_steal_pointer(&ret); } @@ -1162,7 +1162,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src, } } - VIR_RETURN_PTR(fileprops); + return g_steal_pointer(&fileprops); } @@ -1315,7 +1315,7 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSourcePtr src) if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0) return NULL; - VIR_RETURN_PTR(props); + return g_steal_pointer(&props); } @@ -1387,7 +1387,7 @@ qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src) virJSONValueObjectAdd(props, "s:driver", driver, NULL) < 0) return NULL; - VIR_RETURN_PTR(props); + return g_steal_pointer(&props); } @@ -1435,7 +1435,7 @@ qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src, } } - VIR_RETURN_PTR(props); + return g_steal_pointer(&props); } @@ -1496,7 +1496,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src, data->storageNodeName = src->nodestorage; data->formatNodeName = src->nodeformat; - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } @@ -1753,7 +1753,7 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSourcePtr src) return NULL; } - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } @@ -1781,7 +1781,7 @@ qemuBlockStorageSourceChainDetachPrepareDrive(virStorageSourcePtr src, if (VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend) < 0) return NULL; - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index cda31f8719..6b2c370d9f 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -118,7 +118,7 @@ qemuBlockJobDataNew(qemuBlockJobType type, job->newstate = -1; job->type = type; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } @@ -214,7 +214,7 @@ qemuBlockJobDiskNew(virDomainObjPtr vm, if (qemuBlockJobRegister(job, vm, disk, true) < 0) return NULL; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } @@ -243,7 +243,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm, if (qemuBlockJobRegister(job, vm, disk, true) < 0) return NULL; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } @@ -280,7 +280,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, if (qemuBlockJobRegister(job, vm, disk, true) < 0) return NULL; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } @@ -311,7 +311,7 @@ qemuBlockJobNewCreate(virDomainObjPtr vm, if (qemuBlockJobRegister(job, vm, NULL, true) < 0) return NULL; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } @@ -345,7 +345,7 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm, if (qemuBlockJobRegister(job, vm, disk, true) < 0) return NULL; - VIR_RETURN_PTR(job); + return g_steal_pointer(&job); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d5f29ba5d4..3991ea3234 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10535,7 +10535,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, cfg->logTimestamp) virCommandAddArgList(cmd, "-msg", "timestamp=on", NULL); - VIR_RETURN_PTR(cmd); + return g_steal_pointer(&cmd); } @@ -10724,7 +10724,7 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) virJSONValueObjectPrependString(ret, "driver", vcpupriv->type) < 0) return NULL; - VIR_RETURN_PTR(ret); + return g_steal_pointer(&ret); } @@ -10824,7 +10824,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, if (VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, elem) < 0) return NULL; - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } @@ -10874,7 +10874,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top, return NULL; } - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } @@ -10901,5 +10901,5 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top, qemuCaps) < 0) return NULL; - VIR_RETURN_PTR(data); + return g_steal_pointer(&data); } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 10d06d7e1c..01ac6faed8 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -302,7 +302,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) &cfg->nfirmwares) < 0) return NULL; - VIR_RETURN_PTR(cfg); + return g_steal_pointer(&cfg); } @@ -1292,7 +1292,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver) "DOI \"%s\"", model, doi); } - VIR_RETURN_PTR(caps); + return g_steal_pointer(&caps); } @@ -1411,7 +1411,7 @@ virQEMUDriverGetDomainCapabilities(virQEMUDriverPtr driver, } virObjectRef(domCaps); - VIR_RETURN_PTR(domCaps); + return g_steal_pointer(&domCaps); } diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c index d0f25dd0d4..f4205a74bb 100644 --- a/src/qemu/qemu_dbus.c +++ b/src/qemu/qemu_dbus.c @@ -48,7 +48,7 @@ qemuDBusVMStateNew(const char *id, const char *addr) if (VIR_STRDUP(self->addr, addr) < 0) return NULL; - VIR_RETURN_PTR(self); + return g_steal_pointer(&self); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1bda2f5159..e8f8749b94 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3039,7 +3039,7 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node, if (virDomainDiskBackingStoreParse(ctxt, src, xmlflags, xmlopt) < 0) return NULL; - VIR_RETURN_PTR(src); + return g_steal_pointer(&src); } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 11d21837ea..6e3e634b30 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -662,7 +662,7 @@ qemuInterfacePrepareSlirp(virQEMUDriverPtr driver, return NULL; } - VIR_RETURN_PTR(slirp); + return g_steal_pointer(&slirp); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5ca7c592dc..70edd04773 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2568,7 +2568,7 @@ qemuMonitorJSONBlockStatsCollectData(virJSONValuePtr dev, bstats->wr_highest_offset_valid = true; } - VIR_RETURN_PTR(bstats); + return g_steal_pointer(&bstats); } diff --git a/src/qemu/qemu_qapi.c b/src/qemu/qemu_qapi.c index 41179f72ec..484f274c63 100644 --- a/src/qemu/qemu_qapi.c +++ b/src/qemu/qemu_qapi.c @@ -512,5 +512,5 @@ virQEMUQAPISchemaConvert(virJSONValuePtr schemareply) schema) < 0) return NULL; - VIR_RETURN_PTR(schema); + return g_steal_pointer(&schema); } diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index 6e6393f49d..0b45315a0b 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -90,7 +90,7 @@ qemuSlirpNew(void) slirp->pid = (pid_t)-1; slirp->fd[0] = slirp->fd[1] = -1; - VIR_RETURN_PTR(slirp); + return g_steal_pointer(&slirp); } @@ -141,7 +141,7 @@ qemuSlirpNewForHelper(const char *helper) qemuSlirpSetFeature(slirp, tmp); } - VIR_RETURN_PTR(slirp); + return g_steal_pointer(&slirp); } diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 5ceadc6026..2a4a095347 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -200,7 +200,7 @@ virHostdevManagerNew(void) umask(old_umask); } - VIR_RETURN_PTR(hostdevMgr); + return g_steal_pointer(&hostdevMgr); } virHostdevManagerPtr @@ -285,7 +285,7 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) pci = NULL; } - VIR_RETURN_PTR(pcidevs); + return g_steal_pointer(&pcidevs); } static int diff --git a/src/util/virpci.c b/src/util/virpci.c index fa1c67b4cb..d173b29476 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1419,7 +1419,7 @@ virPCIDeviceNew(unsigned int domain, VIR_DEBUG("%s %s: initialized", dev->id, dev->name); - VIR_RETURN_PTR(dev); + return g_steal_pointer(&dev); } diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index b7d347b389..dd03c98a16 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -126,5 +126,5 @@ virshCommaStringListComplete(const char *input, nret++; } - VIR_RETURN_PTR(ret); + return g_steal_pointer(&ret); } -- 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list