1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Use g_steal_pointer instead of VIR_STEAL_PTR everywhere

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2019-10-16 13:45:15 +02:00
parent a3931b4996
commit b6108a04ea
34 changed files with 71 additions and 71 deletions

View File

@ -451,7 +451,7 @@ remoteAdminConnectGetLoggingOutputs(virAdmConnectPtr conn,
goto done;
if (outputs)
VIR_STEAL_PTR(*outputs, ret.outputs);
*outputs = g_steal_pointer(&ret.outputs);
rv = ret.noutputs;
xdr_free((xdrproc_t) xdr_admin_connect_get_logging_outputs_ret, (char *) &ret);

View File

@ -490,7 +490,7 @@ adminDispatchConnectGetLoggingOutputs(virNetServerPtr server G_GNUC_UNUSED,
return -1;
}
VIR_STEAL_PTR(ret->outputs, outputs);
ret->outputs = g_steal_pointer(&outputs);
ret->noutputs = noutputs;
return 0;

View File

@ -223,7 +223,7 @@ bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
cmd->num_args++;
}
VIR_STEAL_PTR(*data, cmd);
*data = g_steal_pointer(&cmd);
ret = 0;
cleanup:

View File

@ -2218,8 +2218,8 @@ x86Decode(virCPUDefPtr cpu,
VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
model->name, NULLSTR(sigs), (unsigned long)signature);
VIR_STEAL_PTR(cpu->model, cpuModel->model);
VIR_STEAL_PTR(cpu->features, cpuModel->features);
cpu->model = g_steal_pointer(&cpuModel->model);
cpu->features = g_steal_pointer(&cpuModel->features);
cpu->nfeatures = cpuModel->nfeatures;
cpuModel->nfeatures = 0;
cpu->nfeatures_max = cpuModel->nfeatures_max;

View File

@ -3047,7 +3047,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare3 %p flags=0x%x", dconn, destflags);
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
if (useParams) {
@ -3111,7 +3111,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
*/
VIR_DEBUG("Perform3 %p uri=%s", domain->conn, uri);
VIR_FREE(cookiein);
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
/* dconnuri not relevant in non-P2P modes, so left NULL here */
@ -3149,7 +3149,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
*/
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
VIR_FREE(cookiein);
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
if (useParams) {
@ -3225,7 +3225,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
if (notify_source) {
VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain);
VIR_FREE(cookiein);
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
if (useParams) {

View File

@ -1306,7 +1306,7 @@ xenParseVif(char *entry, const char *vif_typename)
net->bandwidth = bandwidth;
}
VIR_STEAL_PTR(ret, net);
ret = g_steal_pointer(&net);
cleanup:
virDomainNetDefFree(net);

View File

@ -463,7 +463,7 @@ static int virLockManagerLockDaemonNew(virLockManagerPtr lock,
goto cleanup;
}
VIR_STEAL_PTR(lock->privateData, priv);
lock->privateData = g_steal_pointer(&priv);
ret = 0;
cleanup:
virLockManagerLockDaemonPrivateFree(priv);
@ -601,8 +601,8 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
if (VIR_EXPAND_N(priv->resources, priv->nresources, 1) < 0)
goto cleanup;
VIR_STEAL_PTR(priv->resources[priv->nresources-1].lockspace, newLockspace);
VIR_STEAL_PTR(priv->resources[priv->nresources-1].name, newName);
priv->resources[priv->nresources-1].lockspace = g_steal_pointer(&newLockspace);
priv->resources[priv->nresources-1].name = g_steal_pointer(&newName);
if (flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)
priv->resources[priv->nresources-1].flags |=

View File

@ -194,7 +194,7 @@ networkDnsmasqDefNamespaceParse(xmlXPathContextPtr ctxt,
goto cleanup;
if (nsdata->noptions > 0)
VIR_STEAL_PTR(*data, nsdata);
*data = g_steal_pointer(&nsdata);
ret = 0;

View File

@ -1468,7 +1468,7 @@ phypGetBackingDevice(virConnectPtr conn, const char *managed_system,
if (VIR_STRDUP(backing_device, char_ptr) < 0)
goto cleanup;
} else {
VIR_STEAL_PTR(backing_device, ret);
backing_device = g_steal_pointer(&ret);
}
char_ptr = strchr(backing_device, '\n');

View File

@ -858,8 +858,8 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
switch ((remoteDriverMode)mode) {
case REMOTE_DRIVER_MODE_LEGACY:
VIR_STEAL_PTR(sock_name, legacy_sock_name);
VIR_STEAL_PTR(*daemon, legacy_daemon);
sock_name = g_steal_pointer(&legacy_sock_name);
*daemon = g_steal_pointer(&legacy_daemon);
break;
case REMOTE_DRIVER_MODE_DIRECT:
@ -876,8 +876,8 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
return NULL;
}
VIR_STEAL_PTR(sock_name, direct_sock_name);
VIR_STEAL_PTR(*daemon, direct_daemon);
sock_name = g_steal_pointer(&direct_sock_name);
*daemon = g_steal_pointer(&direct_daemon);
break;
case REMOTE_DRIVER_MODE_AUTO:

View File

@ -1063,7 +1063,7 @@ virNetLibsshSessionAuthAddPrivKeyAuth(virNetLibsshSessionPtr sess,
goto error;
}
VIR_STEAL_PTR(auth->password, pass);
auth->password = g_steal_pointer(&pass);
auth->filename = file;
auth->method = VIR_NET_LIBSSH_AUTH_PRIVKEY;
auth->ssh_flags = SSH_AUTH_METHOD_PUBLICKEY;

View File

@ -228,7 +228,7 @@ secretDefineXML(virConnectPtr conn,
if (!(obj = virSecretObjListAdd(driver->secrets, def,
driver->configDir, &backup)))
goto cleanup;
VIR_STEAL_PTR(objDef, def);
objDef = g_steal_pointer(&def);
if (!objDef->isephemeral) {
if (backup && backup->isephemeral) {
@ -269,7 +269,7 @@ secretDefineXML(virConnectPtr conn,
* the backup; otherwise, this is a new secret, thus remove it. */
if (backup) {
virSecretObjSetDef(obj, backup);
VIR_STEAL_PTR(def, objDef);
def = g_steal_pointer(&objDef);
} else {
virSecretObjListRemove(driver->secrets, obj);
virObjectUnref(obj);

View File

@ -96,7 +96,7 @@ virSecurityManagerNewDriver(virSecurityDriverPtr drv,
mgr->drv = drv;
mgr->flags = flags;
mgr->virtDriver = virtDriver;
VIR_STEAL_PTR(mgr->privateData, privateData);
mgr->privateData = g_steal_pointer(&privateData);
if (drv->open(mgr) < 0)
goto error;
@ -1378,7 +1378,7 @@ virSecurityManagerMetadataLock(virSecurityManagerPtr mgr G_GNUC_UNUSED,
if (VIR_ALLOC(ret) < 0)
goto cleanup;
VIR_STEAL_PTR(ret->fds, fds);
ret->fds = g_steal_pointer(&fds);
ret->nfds = nfds;
nfds = 0;

View File

@ -358,7 +358,7 @@ create_profile(const char *profile, const char *profile_name,
if (!(tmp = virStringReplace(pcontent, template_end, replace_files)))
goto clean_all;
VIR_FREE(pcontent);
VIR_STEAL_PTR(pcontent, tmp);
pcontent = g_steal_pointer(&tmp);
}
/* write the file */
@ -778,7 +778,7 @@ vah_add_path(virBufferPtr buf, const char *path, const char *perms, bool recursi
if ((pathtmp = mdir_name(pathdir)) == NULL)
goto cleanup;
VIR_FREE(pathdir);
VIR_STEAL_PTR(pathdir, pathtmp);
pathdir = g_steal_pointer(&pathtmp);
}
if (strlen(pathdir) == 1) {

View File

@ -599,7 +599,7 @@ virStoragePoolDefFSNamespaceParse(xmlXPathContextPtr ctxt,
cmdopts->noptions++;
}
VIR_STEAL_PTR(*data, cmdopts);
*data = g_steal_pointer(&cmdopts);
ret = 0;
cleanup:

View File

@ -271,7 +271,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
if (S_ISDIR(st->st_mode)) {
vol->type = VIR_STORAGE_VOL_NETDIR;
vol->target.format = VIR_STORAGE_FILE_DIR;
VIR_STEAL_PTR(*volptr, vol);
*volptr = g_steal_pointer(&vol);
ret = 0;
goto cleanup;
}
@ -320,7 +320,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
vol->target.compat = meta->compat;
meta->compat = NULL;
VIR_STEAL_PTR(*volptr, vol);
*volptr = g_steal_pointer(&vol);
ret = 0;
cleanup:
if (fd)

View File

@ -432,7 +432,7 @@ virISCSIDirectUpdateTargets(struct iscsi_context *iscsi,
goto cleanup;
}
VIR_STEAL_PTR(*targets, tmp_targets);
*targets = g_steal_pointer(&tmp_targets);
*ntargets = tmp_ntargets;
tmp_ntargets = 0;
@ -574,7 +574,7 @@ virStorageBackendISCSIDirectSetConnection(virStoragePoolObjPtr pool,
goto error;
if (portalRet)
VIR_STEAL_PTR(*portalRet, portal);
*portalRet = g_steal_pointer(&portal);
cleanup:
return iscsi;

View File

@ -482,7 +482,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(char **const groups,
if (!(thisSource = virStoragePoolSourceListNewSource(sourceList)))
return -1;
VIR_STEAL_PTR(thisSource->name, vgname);
thisSource->name = g_steal_pointer(&vgname);
}
if (VIR_REALLOC_N(thisSource->devices, thisSource->ndevice + 1) != 0)
@ -493,7 +493,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(char **const groups,
thisSource->format = VIR_STORAGE_POOL_LOGICAL_LVM2;
memset(dev, 0, sizeof(*dev));
VIR_STEAL_PTR(dev->path, pvname);
dev->path = g_steal_pointer(&pvname);
return 0;
}

View File

@ -129,7 +129,7 @@ virStoragePoolDefRBDNamespaceParse(xmlXPathContextPtr ctxt,
cmdopts->noptions++;
}
VIR_STEAL_PTR(*data, cmdopts);
*data = g_steal_pointer(&cmdopts);
ret = 0;
cleanup:
@ -617,7 +617,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
nnames = nimages;
for (i = 0; i < nimages; i++)
VIR_STEAL_PTR(names[i], images[i].name);
names[i] = g_steal_pointer(&images[i].name);
return names;
@ -725,7 +725,7 @@ virStorageBackendRBDRefreshPool(virStoragePoolObjPtr pool)
if (VIR_ALLOC(vol) < 0)
goto cleanup;
VIR_STEAL_PTR(vol->name, names[i]);
vol->name = g_steal_pointer(&names[i]);
r = volStorageBackendRBDRefreshVolInfo(vol, pool, ptr);

View File

@ -335,7 +335,7 @@ createVport(virStoragePoolDefPtr def,
*/
if (VIR_ALLOC(cbdata) == 0) {
memcpy(cbdata->pool_uuid, def->uuid, VIR_UUID_BUFLEN);
VIR_STEAL_PTR(cbdata->fchost_name, name);
cbdata->fchost_name = g_steal_pointer(&name);
if (virThreadCreate(&thread, false, virStoragePoolFCRefreshThread,
cbdata) < 0) {

View File

@ -2023,7 +2023,7 @@ storageVolCreateXML(virStoragePoolPtr pool,
VIR_INFO("Creating volume '%s' in storage pool '%s'",
newvol->name, def->name);
VIR_STEAL_PTR(vol, newvol);
vol = g_steal_pointer(&newvol);
voldef = NULL;
cleanup:
@ -2215,7 +2215,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr pool,
VIR_INFO("Creating volume '%s' in storage pool '%s'",
newvol->name, def->name);
VIR_STEAL_PTR(vol, newvol);
vol = g_steal_pointer(&newvol);
voldef = NULL;
cleanup:

View File

@ -291,7 +291,7 @@ virStorageFileBackendGlusterReadlinkCallback(const char *path,
buf[ret] = '\0';
VIR_STEAL_PTR(*linkpath, buf);
*linkpath = g_steal_pointer(&buf);
return 0;
}

View File

@ -2862,11 +2862,11 @@ virStorageUtilGlusterExtractPoolSources(const char *host,
if (pooltype == VIR_STORAGE_POOL_NETFS) {
src->format = VIR_STORAGE_POOL_NETFS_GLUSTERFS;
VIR_STEAL_PTR(src->dir, volname);
src->dir = g_steal_pointer(&volname);
} else if (pooltype == VIR_STORAGE_POOL_GLUSTER) {
if (VIR_STRDUP(src->dir, "/") < 0)
goto cleanup;
VIR_STEAL_PTR(src->name, volname);
src->name = g_steal_pointer(&volname);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unsupported gluster lookup"));
@ -3450,11 +3450,11 @@ storageBackendProbeTarget(virStorageSourcePtr target,
}
virBitmapFree(target->features);
VIR_STEAL_PTR(target->features, meta->features);
target->features = g_steal_pointer(&meta->features);
if (meta->compat) {
VIR_FREE(target->compat);
VIR_STEAL_PTR(target->compat, meta->compat);
target->compat = g_steal_pointer(&meta->compat);
}
return 0;

View File

@ -1229,7 +1229,7 @@ testParseAuthUsers(testDriverPtr privconn,
}
/* This field is optional. */
privconn->auths[i].password = virXMLPropString(nodes[i], "password");
VIR_STEAL_PTR(privconn->auths[i].username, username);
privconn->auths[i].username = g_steal_pointer(&username);
}
return 0;
@ -2304,7 +2304,7 @@ testDomainSaveImageOpen(testDriverPtr driver,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto error;
VIR_STEAL_PTR(*ret_def, def);
*ret_def = g_steal_pointer(&def);
return fd;
error:
@ -3114,7 +3114,7 @@ testDomainRenameCallback(virDomainObjPtr privdom,
/* Switch name in domain definition. */
VIR_FREE(privdom->def->name);
VIR_STEAL_PTR(privdom->def->name, new_dom_name);
privdom->def->name = g_steal_pointer(&new_dom_name);
event_new = virDomainEventLifecycleNewFromObj(privdom,
VIR_DOMAIN_EVENT_DEFINED,
@ -3529,18 +3529,18 @@ testDomainSetInterfaceParameters(virDomainPtr dom,
VIR_FREE(bandwidth->out);
if (!net->bandwidth) {
VIR_STEAL_PTR(net->bandwidth, bandwidth);
net->bandwidth = g_steal_pointer(&bandwidth);
} else {
if (bandwidth->in) {
VIR_FREE(net->bandwidth->in);
VIR_STEAL_PTR(net->bandwidth->in, bandwidth->in);
net->bandwidth->in = g_steal_pointer(&bandwidth->in);
} else if (inboundSpecified) {
/* if we got here it means user requested @inbound to be cleared */
VIR_FREE(net->bandwidth->in);
}
if (bandwidth->out) {
VIR_FREE(net->bandwidth->out);
VIR_STEAL_PTR(net->bandwidth->out, bandwidth->out);
net->bandwidth->out = g_steal_pointer(&bandwidth->out);
} else if (outboundSpecified) {
/* if we got here it means user requested @outbound to be cleared */
VIR_FREE(net->bandwidth->out);
@ -4754,7 +4754,7 @@ testDomainGetFSInfo(virDomainPtr dom,
info_ret[0]->ndevAlias = info_ret[1]->ndevAlias = 1;
VIR_STEAL_PTR(*info, info_ret);
*info = g_steal_pointer(&info_ret);
ret = 2;
goto cleanup;
@ -4869,7 +4869,7 @@ testDomainGetPerfEvents(virDomainPtr dom,
goto cleanup;
}
VIR_STEAL_PTR(*params, par);
*params = g_steal_pointer(&par);
*nparams = npar;
npar = 0;
@ -5130,7 +5130,7 @@ testDomainInterfaceAddresses(virDomainPtr dom,
VIR_APPEND_ELEMENT_INPLACE(ifaces_ret, ifaces_count, iface);
}
VIR_STEAL_PTR(*ifaces, ifaces_ret);
*ifaces = g_steal_pointer(&ifaces_ret);
ret = ifaces_count;
cleanup:
@ -7550,7 +7550,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
if (VIR_STRDUP(dev->parentName, def->parent) < 0)
goto cleanup;
VIR_STEAL_PTR(ret, dev);
ret = g_steal_pointer(&dev);
cleanup:
virNodeDeviceObjEndAPI(&obj);

View File

@ -3696,7 +3696,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
gVBoxAPI.UINetworkAdapter.GetBridgedInterface(adapter, &utf16);
VBOX_UTF16_TO_UTF8(utf16, &utf8);
VIR_STEAL_PTR(net->data.bridge.brname, utf8);
net->data.bridge.brname = g_steal_pointer(&utf8);
VBOX_UTF16_FREE(utf16);
break;
@ -3706,7 +3706,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
gVBoxAPI.UINetworkAdapter.GetInternalNetwork(adapter, &utf16);
VBOX_UTF16_TO_UTF8(utf16, &utf8);
VIR_STEAL_PTR(net->data.internal.name, utf8);
net->data.internal.name = g_steal_pointer(&utf8);
VBOX_UTF16_FREE(utf16);
break;
@ -3716,7 +3716,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
gVBoxAPI.UINetworkAdapter.GetHostOnlyInterface(adapter, &utf16);
VBOX_UTF16_TO_UTF8(utf16, &utf8);
VIR_STEAL_PTR(net->data.network.name, utf8);
net->data.network.name = g_steal_pointer(&utf8);
VBOX_UTF16_FREE(utf16);
break;

View File

@ -1486,7 +1486,7 @@ virVMXParseConfig(virVMXContext *ctx,
cpu->cores = coresPerSocket;
cpu->threads = 1;
VIR_STEAL_PTR(def->cpu, cpu);
def->cpu = g_steal_pointer(&cpu);
}
/* vmx:sched.cpu.affinity -> def:cpumask */

View File

@ -193,8 +193,8 @@ vzDestroyDriverConnection(void)
vzConnPtr privconn_list;
virMutexLock(&vz_driver_lock);
VIR_STEAL_PTR(driver, vz_driver);
VIR_STEAL_PTR(privconn_list, vz_conn_list);
driver = g_steal_pointer(&vz_driver);
privconn_list = g_steal_pointer(&vz_conn_list);
virMutexUnlock(&vz_driver_lock);
while (privconn_list) {
@ -3189,7 +3189,7 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
VIR_MIGRATE_PARAM_DEST_XML, dom_xml) < 0)
goto done;
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
virObjectUnlock(dom);
@ -3211,7 +3211,7 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
}
VIR_FREE(cookiein);
VIR_STEAL_PTR(cookiein, cookieout);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
cookieoutlen = 0;
if (vzDomainMigratePerformStep(dom, driver, params, nparams, cookiein,

View File

@ -928,7 +928,7 @@ prlsdkParseNetAddress(char *addr)
goto cleanup;
ip->prefix = nbits;
VIR_STEAL_PTR(ret, ip);
ret = g_steal_pointer(&ip);
cleanup:
if (!ret)
@ -4760,7 +4760,7 @@ prlsdkParseSnapshotTree(const char *treexml)
goto cleanup;
}
VIR_STEAL_PTR(ret, snapshots);
ret = g_steal_pointer(&snapshots);
cleanup:
virDomainSnapshotObjListFree(snapshots);

View File

@ -55,7 +55,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
"except-interface=lo\n")))
goto fail;
VIR_FREE(actual);
VIR_STEAL_PTR(actual, tmp);
actual = g_steal_pointer(&tmp);
#endif
if (virTestCompareToFile(actual, outconf) < 0)

View File

@ -230,8 +230,8 @@ testQemuAgentGetFSInfoCommon(virDomainXMLOptionPtr xmlopt,
" \"disk\": [], \"type\": \"xfs\"}]}") < 0)
goto cleanup;
VIR_STEAL_PTR(*test, ret_test);
VIR_STEAL_PTR(*def, ret_def);
*test = g_steal_pointer(&ret_test);
*def = g_steal_pointer(&ret_def);
ret = 0;
cleanup:

View File

@ -387,7 +387,7 @@ testQemuImageCreateLoadDiskXML(const char *name,
if (virDomainSnapshotDiskDefParseXML(node, ctxt, diskdef,
VIR_DOMAIN_DEF_PARSE_STATUS,
xmlopt) == 0)
VIR_STEAL_PTR(ret, diskdef->src);
ret = g_steal_pointer(&diskdef->src);
virDomainSnapshotDiskDefFree(diskdef);
return ret;

View File

@ -75,7 +75,7 @@ prepareObjects(virQEMUDriverPtr driver,
0)))
return -1;
VIR_STEAL_PTR(*vm_ret, vm);
*vm_ret = g_steal_pointer(&vm);
return 0;
}

View File

@ -1073,7 +1073,7 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
fprintf(stderr, "No qemuCaps generated\n");
goto cleanup;
}
VIR_STEAL_PTR(info->qemuCaps, qemuCaps);
info->qemuCaps = g_steal_pointer(&qemuCaps);
if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
goto cleanup;

View File

@ -108,7 +108,7 @@ testStorageFileGetMetadata(const char *path,
if (virStorageFileGetMetadata(def, uid, gid, false) < 0)
return NULL;
VIR_STEAL_PTR(ret, def);
ret = g_steal_pointer(&def);
return ret;
}