[libvirt RFC PATCH 2/5] conf: rename virDomainHostdevSubsysSCSIClear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function is only called from one place, and the object being
"cleared" is never again referenced before being freed, so it doesn't
need to be "cleared", just change its name to *FreeContents() so that
we can remove its VIR_FREEs with a "clear" conscience (pun intended).

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3b9d0da232..3505d29dbe 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2997,13 +2997,13 @@ virDomainHostdevDefNew(void)
 
 
 static void
-virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsysSCSIPtr scsisrc)
+virDomainHostdevSubsysSCSIFreeContents(virDomainHostdevSubsysSCSIPtr scsisrc)
 {
     if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
         virObjectUnref(scsisrc->u.iscsi.src);
         scsisrc->u.iscsi.src = NULL;
     } else {
-        VIR_FREE(scsisrc->u.host.adapter);
+        g_free(scsisrc->u.host.adapter);
         virObjectUnref(scsisrc->u.host.src);
         scsisrc->u.host.src = NULL;
     }
@@ -3048,7 +3048,7 @@ virDomainHostdevDefFreeContents(virDomainHostdevDefPtr def)
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
         switch ((virDomainHostdevSubsysType) def->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
-            virDomainHostdevSubsysSCSIClear(&def->source.subsys.u.scsi);
+            virDomainHostdevSubsysSCSIFreeContents(&def->source.subsys.u.scsi);
             break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
             g_free(def->source.subsys.u.scsi_host.wwpn);
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux