conf: use g_steal_pointer instead of VIR_STEAL_PTR

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:43:01 +02:00
parent 636b8a4b5f
commit efc266883f
12 changed files with 102 additions and 102 deletions

View File

@ -197,7 +197,7 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
return NULL; return NULL;
} }
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
return ret; return ret;
} }

View File

@ -185,14 +185,14 @@ virCPUDefStealModel(virCPUDefPtr dst,
char *vendor_id = NULL; char *vendor_id = NULL;
if (keepVendor) { if (keepVendor) {
VIR_STEAL_PTR(vendor, dst->vendor); vendor = g_steal_pointer(&dst->vendor);
VIR_STEAL_PTR(vendor_id, dst->vendor_id); vendor_id = g_steal_pointer(&dst->vendor_id);
} }
virCPUDefFreeModel(dst); virCPUDefFreeModel(dst);
VIR_STEAL_PTR(dst->model, src->model); dst->model = g_steal_pointer(&src->model);
VIR_STEAL_PTR(dst->features, src->features); dst->features = g_steal_pointer(&src->features);
dst->microcodeVersion = src->microcodeVersion; dst->microcodeVersion = src->microcodeVersion;
dst->nfeatures_max = src->nfeatures_max; dst->nfeatures_max = src->nfeatures_max;
src->nfeatures_max = 0; src->nfeatures_max = 0;
@ -203,8 +203,8 @@ virCPUDefStealModel(virCPUDefPtr dst,
dst->vendor = vendor; dst->vendor = vendor;
dst->vendor_id = vendor_id; dst->vendor_id = vendor_id;
} else { } else {
VIR_STEAL_PTR(dst->vendor, src->vendor); dst->vendor = g_steal_pointer(&src->vendor);
VIR_STEAL_PTR(dst->vendor_id, src->vendor_id); dst->vendor_id = g_steal_pointer(&src->vendor_id);
} }
} }
@ -465,7 +465,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
tsc->scaling = scaling; tsc->scaling = scaling;
} }
VIR_STEAL_PTR(def->tsc, tsc); def->tsc = g_steal_pointer(&tsc);
} }
} }
@ -644,7 +644,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
def->cache->mode = mode; def->cache->mode = mode;
} }
VIR_STEAL_PTR(*cpu, def); *cpu = g_steal_pointer(&def);
ret = 0; ret = 0;
cleanup: cleanup:
@ -987,7 +987,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
} }
} }
VIR_STEAL_PTR(*features, list); *features = g_steal_pointer(&list);
return n; return n;
} }

View File

@ -1757,7 +1757,7 @@ virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def)
addrs) < 0) addrs) < 0)
goto cleanup; goto cleanup;
VIR_STEAL_PTR(ret, addrs); ret = g_steal_pointer(&addrs);
cleanup: cleanup:
virDomainVirtioSerialAddrSetFree(addrs); virDomainVirtioSerialAddrSetFree(addrs);
return ret; return ret;
@ -2094,7 +2094,7 @@ virDomainUSBAddressHubNew(size_t nports)
goto cleanup; goto cleanup;
hub->nports = nports; hub->nports = nports;
VIR_STEAL_PTR(ret, hub); ret = g_steal_pointer(&hub);
cleanup: cleanup:
virDomainUSBAddressHubFree(hub); virDomainUSBAddressHubFree(hub);
return ret; return ret;

View File

@ -229,10 +229,10 @@ virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
return -1; return -1;
cpuModels->models[cpuModels->nmodels].usable = usable; cpuModels->models[cpuModels->nmodels].usable = usable;
VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].name, *name); cpuModels->models[cpuModels->nmodels].name = g_steal_pointer(&*name);
if (blockers) if (blockers)
VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].blockers, *blockers); cpuModels->models[cpuModels->nmodels].blockers = g_steal_pointer(&*blockers);
cpuModels->nmodels++; cpuModels->nmodels++;
return 0; return 0;

View File

@ -1379,7 +1379,7 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, xmlXPathContextPtr ctxt)
} }
if (keywrap->aes || keywrap->dea) if (keywrap->aes || keywrap->dea)
VIR_STEAL_PTR(def->keywrap, keywrap); def->keywrap = g_steal_pointer(&keywrap);
return 0; return 0;
} }
@ -1794,7 +1794,7 @@ virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt)
if (VIR_ALLOC(ret) < 0) if (VIR_ALLOC(ret) < 0)
return NULL; return NULL;
VIR_STEAL_PTR(ret->privateData, priv); ret->privateData = g_steal_pointer(&priv);
return ret; return ret;
} }
@ -2362,7 +2362,7 @@ virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt)
!(vsock->privateData = xmlopt->privateData.vsockNew())) !(vsock->privateData = xmlopt->privateData.vsockNew()))
goto cleanup; goto cleanup;
VIR_STEAL_PTR(ret, vsock); ret = g_steal_pointer(&vsock);
cleanup: cleanup:
virDomainVsockDefFree(vsock); virDomainVsockDefFree(vsock);
return ret; return ret;
@ -4938,7 +4938,7 @@ virDomainPostParseCheckISCSIPath(char **srcpath)
if (virAsprintf(&path, "%s/0", *srcpath) < 0) if (virAsprintf(&path, "%s/0", *srcpath) < 0)
return -1; return -1;
VIR_FREE(*srcpath); VIR_FREE(*srcpath);
VIR_STEAL_PTR(*srcpath, path); *srcpath = g_steal_pointer(&path);
return 0; return 0;
} }
@ -5660,10 +5660,10 @@ virDomainDefPostParseVideo(virDomainDefPtr def,
/* we don't want to format any values we automatically fill in for /* we don't want to format any values we automatically fill in for
* videos into the XML, so clear them, but retain any user-assigned * videos into the XML, so clear them, but retain any user-assigned
* alias */ * alias */
VIR_STEAL_PTR(alias, def->videos[0]->info.alias); alias = g_steal_pointer(&def->videos[0]->info.alias);
virDomainVideoDefClear(def->videos[0]); virDomainVideoDefClear(def->videos[0]);
def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_NONE; def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_NONE;
VIR_STEAL_PTR(def->videos[0]->info.alias, alias); def->videos[0]->info.alias = g_steal_pointer(&alias);
} else { } else {
virDomainDeviceDef device = { virDomainDeviceDef device = {
.type = VIR_DOMAIN_DEVICE_VIDEO, .type = VIR_DOMAIN_DEVICE_VIDEO,
@ -6527,7 +6527,7 @@ virDomainDefValidateAliases(const virDomainDef *def,
goto cleanup; goto cleanup;
if (aliases) if (aliases)
VIR_STEAL_PTR(*aliases, data.aliases); *aliases = g_steal_pointer(&data.aliases);
ret = 0; ret = 0;
cleanup: cleanup:
@ -7511,7 +7511,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt G_GNUC_UNUSED,
(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS && (xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS &&
virDomainDeviceAliasIsUserAlias(aliasStr) && virDomainDeviceAliasIsUserAlias(aliasStr) &&
strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr))) strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
VIR_STEAL_PTR(info->alias, aliasStr); info->alias = g_steal_pointer(&aliasStr);
} }
if (master) { if (master) {
@ -8030,7 +8030,7 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
authdef->secrettype); authdef->secrettype);
return -1; return -1;
} }
VIR_STEAL_PTR(iscsisrc->src->auth, authdef); iscsisrc->src->auth = g_steal_pointer(&authdef);
} }
cur = cur->next; cur = cur->next;
} }
@ -8096,7 +8096,7 @@ virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode,
virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed 'wwpn' value")); virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed 'wwpn' value"));
return -1; return -1;
} }
VIR_STEAL_PTR(hostsrc->wwpn, wwpn); hostsrc->wwpn = g_steal_pointer(&wwpn);
break; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE: case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE:
case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST: case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST:
@ -8389,7 +8389,7 @@ virDomainNetIPParseXML(xmlNodePtr node)
return NULL; return NULL;
} }
VIR_STEAL_PTR(ret, ip); ret = g_steal_pointer(&ip);
return ret; return ret;
} }
@ -8803,7 +8803,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
goto error; goto error;
} }
VIR_STEAL_PTR(seclabel->label, p); seclabel->label = g_steal_pointer(&p);
} }
/* Only parse imagelabel, if requested live XML with relabeling */ /* Only parse imagelabel, if requested live XML with relabeling */
@ -8817,14 +8817,14 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
"%s", _("security imagelabel is missing")); "%s", _("security imagelabel is missing"));
goto error; goto error;
} }
VIR_STEAL_PTR(seclabel->imagelabel, p); seclabel->imagelabel = g_steal_pointer(&p);
} }
/* Only parse baselabel for dynamic label type */ /* Only parse baselabel for dynamic label type */
if (seclabel->type == VIR_DOMAIN_SECLABEL_DYNAMIC) { if (seclabel->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
p = virXPathStringLimit("string(./baselabel[1])", p = virXPathStringLimit("string(./baselabel[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt); VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
VIR_STEAL_PTR(seclabel->baselabel, p); seclabel->baselabel = g_steal_pointer(&p);
} }
return seclabel; return seclabel;
@ -9105,9 +9105,9 @@ virDomainLeaseDefParseXML(xmlNodePtr node)
goto error; goto error;
} }
VIR_STEAL_PTR(def->key, key); def->key = g_steal_pointer(&key);
VIR_STEAL_PTR(def->lockspace, lockspace); def->lockspace = g_steal_pointer(&lockspace);
VIR_STEAL_PTR(def->path, path); def->path = g_steal_pointer(&path);
cleanup: cleanup:
return def; return def;
@ -9156,7 +9156,7 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
goto cleanup; goto cleanup;
} }
VIR_STEAL_PTR(*srcpool, source); *srcpool = g_steal_pointer(&source);
ret = 0; ret = 0;
cleanup: cleanup:
@ -9305,7 +9305,7 @@ virDomainStorageSourceParseBase(const char *type,
return NULL; return NULL;
} }
VIR_STEAL_PTR(ret, src); ret = g_steal_pointer(&src);
return ret; return ret;
} }
@ -9442,7 +9442,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) < 0) virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) < 0)
return -1; return -1;
VIR_STEAL_PTR(src->backingStore, backingStore); src->backingStore = g_steal_pointer(&backingStore);
return 0; return 0;
} }
@ -10343,16 +10343,16 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
def->startupPolicy = val; def->startupPolicy = val;
} }
VIR_STEAL_PTR(def->dst, target); def->dst = g_steal_pointer(&target);
if (authdef) if (authdef)
VIR_STEAL_PTR(def->src->auth, authdef); def->src->auth = g_steal_pointer(&authdef);
if (encryption) if (encryption)
VIR_STEAL_PTR(def->src->encryption, encryption); def->src->encryption = g_steal_pointer(&encryption);
VIR_STEAL_PTR(def->domain_name, domain_name); def->domain_name = g_steal_pointer(&domain_name);
VIR_STEAL_PTR(def->serial, serial); def->serial = g_steal_pointer(&serial);
VIR_STEAL_PTR(def->wwn, wwn); def->wwn = g_steal_pointer(&wwn);
VIR_STEAL_PTR(def->vendor, vendor); def->vendor = g_steal_pointer(&vendor);
VIR_STEAL_PTR(def->product, product); def->product = g_steal_pointer(&product);
if (virDomainDiskBackingStoreParse(ctxt, def->src, flags, xmlopt) < 0) if (virDomainDiskBackingStoreParse(ctxt, def->src, flags, xmlopt) < 0)
goto error; goto error;
@ -11179,8 +11179,8 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
VIR_STEAL_PTR(def->src->path, source); def->src->path = g_steal_pointer(&source);
VIR_STEAL_PTR(def->dst, target); def->dst = g_steal_pointer(&target);
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
goto error; goto error;
@ -11358,7 +11358,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &actual->vlan) < 0) if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &actual->vlan) < 0)
goto error; goto error;
VIR_STEAL_PTR(*def, actual); *def = g_steal_pointer(&actual);
ret = 0; ret = 0;
error: error:
virDomainActualNetDefFree(actual); virDomainActualNetDefFree(actual);
@ -11762,9 +11762,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
VIR_STEAL_PTR(def->data.network.name, network); def->data.network.name = g_steal_pointer(&network);
VIR_STEAL_PTR(def->data.network.portgroup, portgroup); def->data.network.portgroup = g_steal_pointer(&portgroup);
VIR_STEAL_PTR(def->data.network.actual, actual); def->data.network.actual = g_steal_pointer(&actual);
break; break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
@ -11810,7 +11810,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
def->data.vhostuser->type = VIR_DOMAIN_CHR_TYPE_UNIX; def->data.vhostuser->type = VIR_DOMAIN_CHR_TYPE_UNIX;
VIR_STEAL_PTR(def->data.vhostuser->data.nix.path, vhostuser_path); def->data.vhostuser->data.nix.path = g_steal_pointer(&vhostuser_path);
if (STREQ(vhostuser_mode, "server")) { if (STREQ(vhostuser_mode, "server")) {
def->data.vhostuser->data.nix.listen = true; def->data.vhostuser->data.nix.listen = true;
@ -11839,7 +11839,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
"specified with <interface type='bridge'/>")); "specified with <interface type='bridge'/>"));
goto error; goto error;
} }
VIR_STEAL_PTR(def->data.bridge.brname, bridge); def->data.bridge.brname = g_steal_pointer(&bridge);
break; break;
case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_CLIENT:
@ -11869,7 +11869,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
} else { } else {
VIR_STEAL_PTR(def->data.socket.address, address); def->data.socket.address = g_steal_pointer(&address);
} }
if (def->type != VIR_DOMAIN_NET_TYPE_UDP) if (def->type != VIR_DOMAIN_NET_TYPE_UDP)
@ -11894,7 +11894,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
"specified with socket interface")); "specified with socket interface"));
goto error; goto error;
} else { } else {
VIR_STEAL_PTR(def->data.socket.localaddr, localaddr); def->data.socket.localaddr = g_steal_pointer(&localaddr);
} }
break; break;
@ -11905,7 +11905,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
"with <interface type='internal'/>")); "with <interface type='internal'/>"));
goto error; goto error;
} }
VIR_STEAL_PTR(def->data.internal.name, internal); def->data.internal.name = g_steal_pointer(&internal);
break; break;
case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_DIRECT:
@ -11927,7 +11927,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_VEPA; def->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_VEPA;
} }
VIR_STEAL_PTR(def->data.direct.linkdev, dev); def->data.direct.linkdev = g_steal_pointer(&dev);
if (ifname && if (ifname &&
flags & VIR_DOMAIN_DEF_PARSE_INACTIVE && flags & VIR_DOMAIN_DEF_PARSE_INACTIVE &&
@ -11990,15 +11990,15 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
if (script != NULL) if (script != NULL)
VIR_STEAL_PTR(def->script, script); def->script = g_steal_pointer(&script);
if (domain_name != NULL) if (domain_name != NULL)
VIR_STEAL_PTR(def->domain_name, domain_name); def->domain_name = g_steal_pointer(&domain_name);
if (ifname != NULL) if (ifname != NULL)
VIR_STEAL_PTR(def->ifname, ifname); def->ifname = g_steal_pointer(&ifname);
if (ifname_guest != NULL) if (ifname_guest != NULL)
VIR_STEAL_PTR(def->ifname_guest, ifname_guest); def->ifname_guest = g_steal_pointer(&ifname_guest);
if (ifname_guest_actual != NULL) if (ifname_guest_actual != NULL)
VIR_STEAL_PTR(def->ifname_guest_actual, ifname_guest_actual); def->ifname_guest_actual = g_steal_pointer(&ifname_guest_actual);
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
virDomainNetIsVirtioModel(def)) { virDomainNetIsVirtioModel(def)) {
@ -12198,7 +12198,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->driver.virtio.guest.ufo = val; def->driver.virtio.guest.ufo = val;
} }
} }
VIR_STEAL_PTR(def->backend.vhost, vhost_path); def->backend.vhost = g_steal_pointer(&vhost_path);
} }
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
@ -12216,8 +12216,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_BRIDGE:
VIR_STEAL_PTR(def->filter, filter); def->filter = g_steal_pointer(&filter);
VIR_STEAL_PTR(def->filterparams, filterparams); def->filterparams = g_steal_pointer(&filterparams);
break; break;
case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
@ -13213,7 +13213,7 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
path = virXPathString("string(./backend/device/@path)", ctxt); path = virXPathString("string(./backend/device/@path)", ctxt);
if (!path && VIR_STRDUP(path, VIR_DOMAIN_TPM_DEFAULT_DEVICE) < 0) if (!path && VIR_STRDUP(path, VIR_DOMAIN_TPM_DEFAULT_DEVICE) < 0)
goto error; goto error;
VIR_STEAL_PTR(def->data.passthrough.source.data.file.path, path); def->data.passthrough.source.data.file.path = g_steal_pointer(&path);
def->data.passthrough.source.type = VIR_DOMAIN_CHR_TYPE_DEV; def->data.passthrough.source.type = VIR_DOMAIN_CHR_TYPE_DEV;
break; break;
case VIR_DOMAIN_TPM_TYPE_EMULATOR: case VIR_DOMAIN_TPM_TYPE_EMULATOR:
@ -13751,7 +13751,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
} }
if (!address) if (!address)
VIR_STEAL_PTR(address, addressCompat); address = g_steal_pointer(&addressCompat);
} }
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
@ -13764,14 +13764,14 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
} }
if (!socketPath) if (!socketPath)
VIR_STEAL_PTR(socketPath, socketCompat); socketPath = g_steal_pointer(&socketCompat);
} }
if (address && address[0] && if (address && address[0] &&
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK && (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)))) { !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)))) {
VIR_STEAL_PTR(def->address, address); def->address = g_steal_pointer(&address);
} }
if (network && network[0]) { if (network && network[0]) {
@ -13781,7 +13781,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
"type 'network'")); "type 'network'"));
goto error; goto error;
} }
VIR_STEAL_PTR(def->network, network); def->network = g_steal_pointer(&network);
} }
if (socketPath && socketPath[0]) { if (socketPath && socketPath[0]) {
@ -13791,7 +13791,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
"type 'socket'")); "type 'socket'"));
goto error; goto error;
} }
VIR_STEAL_PTR(def->socket, socketPath); def->socket = g_steal_pointer(&socketPath);
} }
if (fromConfig && if (fromConfig &&
@ -13870,7 +13870,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
if (socketPath) { if (socketPath) {
newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET;
VIR_STEAL_PTR(newListen.socket, socketPath); newListen.socket = g_steal_pointer(&socketPath);
} else { } else {
newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
newListen.address = virXMLPropString(node, "listen"); newListen.address = virXMLPropString(node, "listen");
@ -14348,7 +14348,7 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def,
} }
def->data.spice.gl = enableVal; def->data.spice.gl = enableVal;
VIR_STEAL_PTR(def->data.spice.rendernode, rendernode); def->data.spice.rendernode = g_steal_pointer(&rendernode);
} else if (virXMLNodeNameEqual(cur, "mouse")) { } else if (virXMLNodeNameEqual(cur, "mouse")) {
int modeVal; int modeVal;
@ -14921,7 +14921,7 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
goto cleanup; goto cleanup;
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
cleanup: cleanup:
virDomainShmemDefFree(def); virDomainShmemDefFree(def);
return ret; return ret;
@ -14981,7 +14981,7 @@ virSysinfoBIOSParseXML(xmlNodePtr node,
def = NULL; def = NULL;
} }
VIR_STEAL_PTR(*bios, def); *bios = g_steal_pointer(&def);
ret = 0; ret = 0;
cleanup: cleanup:
virSysinfoBIOSDefFree(def); virSysinfoBIOSDefFree(def);
@ -15057,7 +15057,7 @@ virSysinfoSystemParseXML(xmlNodePtr node,
def = NULL; def = NULL;
} }
VIR_STEAL_PTR(*sysdef, def); *sysdef = g_steal_pointer(&def);
ret = 0; ret = 0;
cleanup: cleanup:
virSysinfoSystemDefFree(def); virSysinfoSystemDefFree(def);
@ -15108,7 +15108,7 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
} }
} }
VIR_STEAL_PTR(*baseBoard, boards); *baseBoard = g_steal_pointer(&boards);
*nbaseBoard = nboards; *nbaseBoard = nboards;
ret = 0; ret = 0;
cleanup: cleanup:
@ -15146,7 +15146,7 @@ virSysinfoOEMStringsParseXML(xmlNodePtr node,
for (i = 0; i < nstrings; i++) for (i = 0; i < nstrings; i++)
def->values[i] = virXMLNodeContentString(strings[i]); def->values[i] = virXMLNodeContentString(strings[i]);
VIR_STEAL_PTR(*oem, def); *oem = g_steal_pointer(&def);
ret = 0; ret = 0;
cleanup: cleanup:
virSysinfoOEMStringsDefFree(def); virSysinfoOEMStringsDefFree(def);
@ -15191,7 +15191,7 @@ virSysinfoChassisParseXML(xmlNodePtr node,
def = NULL; def = NULL;
} }
VIR_STEAL_PTR(*chassisdef, def); *chassisdef = g_steal_pointer(&def);
ret = 0; ret = 0;
cleanup: cleanup:
virSysinfoChassisDefFree(def); virSysinfoChassisDefFree(def);
@ -16315,7 +16315,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
} }
} }
VIR_STEAL_PTR(ret, iommu); ret = g_steal_pointer(&iommu);
cleanup: cleanup:
return ret; return ret;
@ -16378,7 +16378,7 @@ virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
if (virDomainDeviceInfoParseXML(xmlopt, node, &vsock->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, &vsock->info, flags) < 0)
goto cleanup; goto cleanup;
VIR_STEAL_PTR(ret, vsock); ret = g_steal_pointer(&vsock);
cleanup: cleanup:
return ret; return ret;
@ -18372,7 +18372,7 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node,
return -1; return -1;
} }
VIR_STEAL_PTR(iothrid->cpumask, cpumask); iothrid->cpumask = g_steal_pointer(&cpumask);
return 0; return 0;
} }
@ -18403,7 +18403,7 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node)
return NULL; return NULL;
} }
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
return ret; return ret;
} }
@ -18738,7 +18738,7 @@ virDomainEmulatorSchedParse(xmlNodePtr node,
&sched->priority) < 0) &sched->priority) < 0)
return -1; return -1;
VIR_STEAL_PTR(def->cputune.emulatorsched, sched); def->cputune.emulatorsched = g_steal_pointer(&sched);
return 0; return 0;
} }
@ -19506,7 +19506,7 @@ virDomainResctrlNew(xmlNodePtr node,
resctrl->alloc = virObjectRef(alloc); resctrl->alloc = virObjectRef(alloc);
VIR_STEAL_PTR(ret, resctrl); ret = g_steal_pointer(&resctrl);
cleanup: cleanup:
virDomainResctrlDefFree(resctrl); virDomainResctrlDefFree(resctrl);
return ret; return ret;
@ -30529,7 +30529,7 @@ virDomainDiskSetBlockIOTune(virDomainDiskDefPtr disk,
VIR_FREE(disk->blkdeviotune.group_name); VIR_FREE(disk->blkdeviotune.group_name);
disk->blkdeviotune = *info; disk->blkdeviotune = *info;
VIR_STEAL_PTR(disk->blkdeviotune.group_name, tmp_group); disk->blkdeviotune.group_name = g_steal_pointer(&tmp_group);
return 0; return 0;
} }

View File

@ -2354,7 +2354,7 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def,
#undef MAYBE_ADD_CAP #undef MAYBE_ADD_CAP
if (want_list) if (want_list)
VIR_STEAL_PTR(*list, tmp); *list = g_steal_pointer(&tmp);
ret = ncaps; ret = ncaps;
cleanup: cleanup:
VIR_FREE(tmp); VIR_FREE(tmp);
@ -2386,18 +2386,18 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
goto cleanup; goto cleanup;
} }
VIR_FREE(scsi_host->wwpn); VIR_FREE(scsi_host->wwpn);
VIR_STEAL_PTR(scsi_host->wwpn, tmp); scsi_host->wwpn = g_steal_pointer(&tmp);
if (!(tmp = virVHBAGetConfig(NULL, scsi_host->host, "node_name"))) { if (!(tmp = virVHBAGetConfig(NULL, scsi_host->host, "node_name"))) {
VIR_WARN("Failed to read WWNN for host%d", scsi_host->host); VIR_WARN("Failed to read WWNN for host%d", scsi_host->host);
goto cleanup; goto cleanup;
} }
VIR_FREE(scsi_host->wwnn); VIR_FREE(scsi_host->wwnn);
VIR_STEAL_PTR(scsi_host->wwnn, tmp); scsi_host->wwnn = g_steal_pointer(&tmp);
if ((tmp = virVHBAGetConfig(NULL, scsi_host->host, "fabric_name"))) { if ((tmp = virVHBAGetConfig(NULL, scsi_host->host, "fabric_name"))) {
VIR_FREE(scsi_host->fabric_wwn); VIR_FREE(scsi_host->fabric_wwn);
VIR_STEAL_PTR(scsi_host->fabric_wwn, tmp); scsi_host->fabric_wwn = g_steal_pointer(&tmp);
} }
} }
@ -2466,7 +2466,7 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
goto cleanup; goto cleanup;
VIR_FREE(scsi_target->rport); VIR_FREE(scsi_target->rport);
VIR_STEAL_PTR(scsi_target->rport, rport); scsi_target->rport = g_steal_pointer(&rport);
if (virFCReadRportValue(scsi_target->rport, "port_name", if (virFCReadRportValue(scsi_target->rport, "port_name",
&scsi_target->wwpn) < 0) { &scsi_target->wwpn) < 0) {
@ -2591,7 +2591,7 @@ virNodeDeviceGetPCIMdevTypesCaps(const char *sysfspath,
if (rc <= 0) if (rc <= 0)
return rc; return rc;
VIR_STEAL_PTR(pci_dev->mdev_types, types); pci_dev->mdev_types = g_steal_pointer(&types);
pci_dev->nmdev_types = rc; pci_dev->nmdev_types = rc;
pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_MDEV;

View File

@ -362,7 +362,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
"disk-only snapshot")); "disk-only snapshot"));
goto cleanup; goto cleanup;
} }
VIR_STEAL_PTR(def->file, memoryFile); def->file = g_steal_pointer(&memoryFile);
/* verify that memory path is absolute */ /* verify that memory path is absolute */
if (def->file && def->file[0] != '/') { if (def->file && def->file[0] != '/') {
@ -407,7 +407,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
if (!offline && virSaveCookieParse(ctxt, &def->cookie, saveCookie) < 0) if (!offline && virSaveCookieParse(ctxt, &def->cookie, saveCookie) < 0)
goto cleanup; goto cleanup;
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
cleanup: cleanup:
VIR_FREE(creation); VIR_FREE(creation);
@ -543,7 +543,7 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def,
return -1; return -1;
} else { } else {
/* Transfer the domain def */ /* Transfer the domain def */
VIR_STEAL_PTR(def->parent.dom, otherdef->parent.dom); def->parent.dom = g_steal_pointer(&otherdef->parent.dom);
} }
} }
} }
@ -1008,7 +1008,7 @@ virDomainSnapshotRedefinePrep(virDomainObjPtr vm,
flags) < 0) { flags) < 0) {
/* revert any stealing of the snapshot domain definition */ /* revert any stealing of the snapshot domain definition */
if (check_if_stolen && def->parent.dom && !otherdef->parent.dom) if (check_if_stolen && def->parent.dom && !otherdef->parent.dom)
VIR_STEAL_PTR(otherdef->parent.dom, def->parent.dom); otherdef->parent.dom = g_steal_pointer(&def->parent.dom);
return -1; return -1;
} }
if (other) { if (other) {

View File

@ -659,7 +659,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
goto cleanup; goto cleanup;
} }
VIR_STEAL_PTR(source->auth, authdef); source->auth = g_steal_pointer(&authdef);
} }
/* Option protocol version string (NFSvN) */ /* Option protocol version string (NFSvN) */
@ -822,7 +822,7 @@ virStoragePoolDefRefreshParse(xmlXPathContextPtr ctxt,
return -1; return -1;
refresh->volume.allocation = tmp; refresh->volume.allocation = tmp;
VIR_STEAL_PTR(def->refresh, refresh); def->refresh = g_steal_pointer(&refresh);
return 0; return 0;
} }
@ -998,7 +998,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
return NULL; return NULL;
} }
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
return ret; return ret;
} }
@ -1433,7 +1433,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
VIR_FREE(nodes); VIR_FREE(nodes);
} }
VIR_STEAL_PTR(ret, def); ret = g_steal_pointer(&def);
return ret; return ret;
} }

View File

@ -620,7 +620,7 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE); obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE);
} }
VIR_STEAL_PTR(ret, obj); ret = g_steal_pointer(&obj);
cleanup: cleanup:
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);

View File

@ -93,7 +93,7 @@ virNWFilterBindingObjStealDef(virNWFilterBindingObjPtr obj)
{ {
virNWFilterBindingDefPtr def; virNWFilterBindingDefPtr def;
VIR_STEAL_PTR(def, obj->def); def = g_steal_pointer(&obj->def);
return def; return def;
} }

View File

@ -393,7 +393,7 @@ virSecretObjListAdd(virSecretObjListPtr secrets,
virObjectRef(obj); virObjectRef(obj);
} }
VIR_STEAL_PTR(ret, obj); ret = g_steal_pointer(&obj);
cleanup: cleanup:
virSecretObjEndAPI(&obj); virSecretObjEndAPI(&obj);

View File

@ -1115,7 +1115,7 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
} }
} }
VIR_STEAL_PTR(*objRet, obj); *objRet = g_steal_pointer(&obj);
ret = 1; ret = 1;
} else { } else {
/* UUID does not match, but if a name matches, refuse it */ /* UUID does not match, but if a name matches, refuse it */
@ -1540,7 +1540,7 @@ virStoragePoolObjAssignDef(virStoragePoolObjPtr obj,
} else { } else {
if (!obj->newDef && if (!obj->newDef &&
flags & VIR_STORAGE_POOL_OBJ_LIST_ADD_LIVE) flags & VIR_STORAGE_POOL_OBJ_LIST_ADD_LIVE)
VIR_STEAL_PTR(obj->newDef, obj->def); obj->newDef = g_steal_pointer(&obj->def);
virStoragePoolDefFree(obj->def); virStoragePoolDefFree(obj->def);
obj->def = def; obj->def = def;