[libvirt] [PATCH 8/9] Use g_steal_pointer instead of VIR_STEAL_PTR everywhere

Ján Tomko jtomko at redhat.com
Wed Oct 16 12:09:09 UTC 2019


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/admin/admin_remote.c                   |  2 +-
 src/admin/admin_server_dispatch.c          |  2 +-
 src/bhyve/bhyve_domain.c                   |  2 +-
 src/cpu/cpu_x86.c                          |  4 ++--
 src/libvirt-domain.c                       |  8 ++++----
 src/libxl/xen_common.c                     |  2 +-
 src/locking/lock_driver_lockd.c            |  6 +++---
 src/network/bridge_driver.c                |  2 +-
 src/phyp/phyp_driver.c                     |  2 +-
 src/remote/remote_driver.c                 |  8 ++++----
 src/rpc/virnetlibsshsession.c              |  2 +-
 src/secret/secret_driver.c                 |  4 ++--
 src/security/security_manager.c            |  4 ++--
 src/security/virt-aa-helper.c              |  4 ++--
 src/storage/storage_backend_fs.c           |  2 +-
 src/storage/storage_backend_gluster.c      |  4 ++--
 src/storage/storage_backend_iscsi_direct.c |  4 ++--
 src/storage/storage_backend_logical.c      |  4 ++--
 src/storage/storage_backend_rbd.c          |  6 +++---
 src/storage/storage_backend_scsi.c         |  2 +-
 src/storage/storage_driver.c               |  4 ++--
 src/storage/storage_file_gluster.c         |  2 +-
 src/storage/storage_util.c                 |  8 ++++----
 src/test/test_driver.c                     | 20 ++++++++++----------
 src/vbox/vbox_common.c                     |  6 +++---
 src/vmx/vmx.c                              |  2 +-
 src/vz/vz_driver.c                         |  8 ++++----
 src/vz/vz_sdk.c                            |  4 ++--
 tests/networkxml2conftest.c                |  2 +-
 tests/qemuagenttest.c                      |  4 ++--
 tests/qemublocktest.c                      |  2 +-
 tests/qemusecuritytest.c                   |  2 +-
 tests/testutilsqemu.c                      |  2 +-
 tests/virstoragetest.c                     |  2 +-
 34 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index 8e0752746c..ca5e0c9fe4 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -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);
diff --git a/src/admin/admin_server_dispatch.c b/src/admin/admin_server_dispatch.c
index 4cc41428ed..e56da3ba9f 100644
--- a/src/admin/admin_server_dispatch.c
+++ b/src/admin/admin_server_dispatch.c
@@ -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;
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index bc506bad66..7d24bb602f 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -223,7 +223,7 @@ bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
         cmd->num_args++;
     }
 
-    VIR_STEAL_PTR(*data, cmd);
+    *data = g_steal_pointer(&cmd);
     ret = 0;
 
  cleanup:
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 7a52ab5d4f..3de99ca057 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -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;
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 68e8ffff3c..dcab179e6e 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -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) {
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 88d6189eae..1a36a632aa 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -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);
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 47b49add66..8277e5ba92 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -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 |=
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 901896d775..6862818698 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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;
 
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index de9f197dae..4527adc670 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -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');
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index a0a0e311e0..9228c7d0ed 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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:
diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
index 136bb1cc33..cd92329230 100644
--- a/src/rpc/virnetlibsshsession.c
+++ b/src/rpc/virnetlibsshsession.c
@@ -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;
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index ad4a684c16..6d2844f3b7 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -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);
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 8ff569e316..952675381d 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -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;
 
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index afc5324b77..9157411133 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -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) {
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index a00308bc17..d96f5a5cb5 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -599,7 +599,7 @@ virStoragePoolDefFSNamespaceParse(xmlXPathContextPtr ctxt,
         cmdopts->noptions++;
     }
 
-    VIR_STEAL_PTR(*data, cmdopts);
+    *data = g_steal_pointer(&cmdopts);
     ret = 0;
 
  cleanup:
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 1b87e800ac..23fe0dc226 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -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)
diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
index 78e347c9b0..7492566099 100644
--- a/src/storage/storage_backend_iscsi_direct.c
+++ b/src/storage/storage_backend_iscsi_direct.c
@@ -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;
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 04f3decdf3..9be6d61a12 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -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;
 }
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 485cabb219..e4154479c2 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -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);
 
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 14bf1352a6..fd243776f8 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -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) {
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d878329a45..981f2a4301 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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:
diff --git a/src/storage/storage_file_gluster.c b/src/storage/storage_file_gluster.c
index babb8fbe94..28f9962c0c 100644
--- a/src/storage/storage_file_gluster.c
+++ b/src/storage/storage_file_gluster.c
@@ -291,7 +291,7 @@ virStorageFileBackendGlusterReadlinkCallback(const char *path,
 
     buf[ret] = '\0';
 
-    VIR_STEAL_PTR(*linkpath, buf);
+    *linkpath = g_steal_pointer(&buf);
 
     return 0;
 }
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index e97bd2151a..410d412ef1 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -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;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 42bb3d19f0..ab7e5fc02a 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -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);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 7fa9a98a1e..56c3c8d896 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -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;
 
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 5396353412..fa7aa79484 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -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 */
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index fe46d6349e..f8c5232018 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -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,
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index cef840fb9f..68284d53f7 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -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);
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index dcb99aad6e..098b5eff09 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -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)
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 58f722cf1b..cef9ae5fee 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -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:
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 6d90e2faf5..0f073682ca 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -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;
diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c
index 288718c2a5..1c6cefd705 100644
--- a/tests/qemusecuritytest.c
+++ b/tests/qemusecuritytest.c
@@ -75,7 +75,7 @@ prepareObjects(virQEMUDriverPtr driver,
                                             0)))
         return -1;
 
-    VIR_STEAL_PTR(*vm_ret, vm);
+    *vm_ret = g_steal_pointer(&vm);
     return 0;
 }
 
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 6eda8daafe..e6eca5cb2e 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -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;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 33ef662115..5d3edbc854 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -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;
 }
 
-- 
2.19.2




More information about the libvir-list mailing list