[PATCH v3 1/9] interface: Consistently use 'obj' for a virInterfaceObjPtr

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

 



Alter variable names to be obj rather than 'iface' and/or 'obj'.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/virinterfaceobj.c | 48 ++++++++++++++--------------
 src/conf/virinterfaceobj.h |  4 +--
 src/test/test_driver.c     | 78 +++++++++++++++++++++++-----------------------
 3 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c
index e80db23..62c3735 100644
--- a/src/conf/virinterfaceobj.c
+++ b/src/conf/virinterfaceobj.c
@@ -51,14 +51,14 @@ virInterfaceObjUnlock(virInterfaceObjPtr obj)
 
 
 void
-virInterfaceObjFree(virInterfaceObjPtr iface)
+virInterfaceObjFree(virInterfaceObjPtr obj)
 {
-    if (!iface)
+    if (!obj)
         return;
 
-    virInterfaceDefFree(iface->def);
-    virMutexDestroy(&iface->lock);
-    VIR_FREE(iface);
+    virInterfaceDefFree(obj->def);
+    virMutexDestroy(&obj->lock);
+    VIR_FREE(obj);
 }
 
 
@@ -136,7 +136,7 @@ virInterfaceObjListClone(virInterfaceObjListPtr src,
     for (i = 0; i < cnt; i++) {
         virInterfaceDefPtr def = src->objs[i]->def;
         virInterfaceDefPtr backup;
-        virInterfaceObjPtr iface;
+        virInterfaceObjPtr obj;
         char *xml = virInterfaceDefFormat(def);
 
         if (!xml)
@@ -148,9 +148,9 @@ virInterfaceObjListClone(virInterfaceObjListPtr src,
         }
 
         VIR_FREE(xml);
-        if ((iface = virInterfaceObjAssignDef(dest, backup)) == NULL)
+        if ((obj = virInterfaceObjAssignDef(dest, backup)) == NULL)
             goto cleanup;
-        virInterfaceObjUnlock(iface); /* locked by virInterfaceObjAssignDef */
+        virInterfaceObjUnlock(obj); /* locked by virInterfaceObjAssignDef */
     }
 
     ret = cnt;
@@ -165,47 +165,47 @@ virInterfaceObjPtr
 virInterfaceObjAssignDef(virInterfaceObjListPtr interfaces,
                          virInterfaceDefPtr def)
 {
-    virInterfaceObjPtr iface;
+    virInterfaceObjPtr obj;
 
-    if ((iface = virInterfaceObjFindByName(interfaces, def->name))) {
-        virInterfaceDefFree(iface->def);
-        iface->def = def;
+    if ((obj = virInterfaceObjFindByName(interfaces, def->name))) {
+        virInterfaceDefFree(obj->def);
+        obj->def = def;
 
-        return iface;
+        return obj;
     }
 
-    if (VIR_ALLOC(iface) < 0)
+    if (VIR_ALLOC(obj) < 0)
         return NULL;
-    if (virMutexInit(&iface->lock) < 0) {
+    if (virMutexInit(&obj->lock) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("cannot initialize mutex"));
-        VIR_FREE(iface);
+        VIR_FREE(obj);
         return NULL;
     }
-    virInterfaceObjLock(iface);
+    virInterfaceObjLock(obj);
 
     if (VIR_APPEND_ELEMENT_COPY(interfaces->objs,
-                                interfaces->count, iface) < 0) {
-        virInterfaceObjFree(iface);
+                                interfaces->count, obj) < 0) {
+        virInterfaceObjFree(obj);
         return NULL;
     }
 
-    iface->def = def;
-    return iface;
+    obj->def = def;
+    return obj;
 
 }
 
 
 void
 virInterfaceObjRemove(virInterfaceObjListPtr interfaces,
-                      virInterfaceObjPtr iface)
+                      virInterfaceObjPtr obj)
 {
     size_t i;
 
-    virInterfaceObjUnlock(iface);
+    virInterfaceObjUnlock(obj);
     for (i = 0; i < interfaces->count; i++) {
         virInterfaceObjLock(interfaces->objs[i]);
-        if (interfaces->objs[i] == iface) {
+        if (interfaces->objs[i] == obj) {
             virInterfaceObjUnlock(interfaces->objs[i]);
             virInterfaceObjFree(interfaces->objs[i]);
 
diff --git a/src/conf/virinterfaceobj.h b/src/conf/virinterfaceobj.h
index 5b0527d..ee166c6 100644
--- a/src/conf/virinterfaceobj.h
+++ b/src/conf/virinterfaceobj.h
@@ -54,7 +54,7 @@ virInterfaceObjFindByName(virInterfaceObjListPtr interfaces,
                           const char *name);
 
 void
-virInterfaceObjFree(virInterfaceObjPtr iface);
+virInterfaceObjFree(virInterfaceObjPtr obj);
 
 void
 virInterfaceObjListFree(virInterfaceObjListPtr vms);
@@ -69,7 +69,7 @@ virInterfaceObjAssignDef(virInterfaceObjListPtr interfaces,
 
 void
 virInterfaceObjRemove(virInterfaceObjListPtr interfaces,
-                      virInterfaceObjPtr iface);
+                      virInterfaceObjPtr obj);
 
 void
 virInterfaceObjLock(virInterfaceObjPtr obj);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 9330d9e..d9f9329 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3627,18 +3627,18 @@ static virInterfaceObjPtr
 testInterfaceObjFindByName(testDriverPtr privconn,
                            const char *name)
 {
-    virInterfaceObjPtr iface;
+    virInterfaceObjPtr obj;
 
     testDriverLock(privconn);
-    iface = virInterfaceObjFindByName(&privconn->ifaces, name);
+    obj = virInterfaceObjFindByName(&privconn->ifaces, name);
     testDriverUnlock(privconn);
 
-    if (!iface)
+    if (!obj)
         virReportError(VIR_ERR_NO_INTERFACE,
                        _("no interface with matching name '%s'"),
                        name);
 
-    return iface;
+    return obj;
 }
 
 
@@ -3705,17 +3705,17 @@ testInterfaceLookupByName(virConnectPtr conn,
                           const char *name)
 {
     testDriverPtr privconn = conn->privateData;
-    virInterfaceObjPtr iface;
+    virInterfaceObjPtr obj;
     virInterfacePtr ret = NULL;
 
-    if (!(iface = testInterfaceObjFindByName(privconn, name)))
+    if (!(obj = testInterfaceObjFindByName(privconn, name)))
         goto cleanup;
 
-    ret = virGetInterface(conn, iface->def->name, iface->def->mac);
+    ret = virGetInterface(conn, obj->def->name, obj->def->mac);
 
  cleanup:
-    if (iface)
-        virInterfaceObjUnlock(iface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     return ret;
 }
 
@@ -3725,12 +3725,12 @@ testInterfaceLookupByMACString(virConnectPtr conn,
                                const char *mac)
 {
     testDriverPtr privconn = conn->privateData;
-    virInterfaceObjPtr iface;
+    virInterfaceObjPtr obj;
     int ifacect;
     virInterfacePtr ret = NULL;
 
     testDriverLock(privconn);
-    ifacect = virInterfaceObjFindByMACString(&privconn->ifaces, mac, &iface, 1);
+    ifacect = virInterfaceObjFindByMACString(&privconn->ifaces, mac, &obj, 1);
     testDriverUnlock(privconn);
 
     if (ifacect == 0) {
@@ -3743,11 +3743,11 @@ testInterfaceLookupByMACString(virConnectPtr conn,
         goto cleanup;
     }
 
-    ret = virGetInterface(conn, iface->def->name, iface->def->mac);
+    ret = virGetInterface(conn, obj->def->name, obj->def->mac);
 
  cleanup:
-    if (iface)
-        virInterfaceObjUnlock(iface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     return ret;
 }
 
@@ -3869,19 +3869,19 @@ testInterfaceGetXMLDesc(virInterfacePtr iface,
                         unsigned int flags)
 {
     testDriverPtr privconn = iface->conn->privateData;
-    virInterfaceObjPtr privinterface;
+    virInterfaceObjPtr obj;
     char *ret = NULL;
 
     virCheckFlags(0, NULL);
 
-    if (!(privinterface = testInterfaceObjFindByName(privconn, iface->name)))
+    if (!(obj = testInterfaceObjFindByName(privconn, iface->name)))
         goto cleanup;
 
-    ret = virInterfaceDefFormat(privinterface->def);
+    ret = virInterfaceDefFormat(obj->def);
 
  cleanup:
-    if (privinterface)
-        virInterfaceObjUnlock(privinterface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     return ret;
 }
 
@@ -3893,7 +3893,7 @@ testInterfaceDefineXML(virConnectPtr conn,
 {
     testDriverPtr privconn = conn->privateData;
     virInterfaceDefPtr def;
-    virInterfaceObjPtr iface = NULL;
+    virInterfaceObjPtr obj = NULL;
     virInterfacePtr ret = NULL;
 
     virCheckFlags(0, NULL);
@@ -3902,16 +3902,16 @@ testInterfaceDefineXML(virConnectPtr conn,
     if ((def = virInterfaceDefParseString(xmlStr)) == NULL)
         goto cleanup;
 
-    if ((iface = virInterfaceObjAssignDef(&privconn->ifaces, def)) == NULL)
+    if ((obj = virInterfaceObjAssignDef(&privconn->ifaces, def)) == NULL)
         goto cleanup;
     def = NULL;
 
-    ret = virGetInterface(conn, iface->def->name, iface->def->mac);
+    ret = virGetInterface(conn, obj->def->name, obj->def->mac);
 
  cleanup:
     virInterfaceDefFree(def);
-    if (iface)
-        virInterfaceObjUnlock(iface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     testDriverUnlock(privconn);
     return ret;
 }
@@ -3921,13 +3921,13 @@ static int
 testInterfaceUndefine(virInterfacePtr iface)
 {
     testDriverPtr privconn = iface->conn->privateData;
-    virInterfaceObjPtr privinterface;
+    virInterfaceObjPtr obj;
     int ret = -1;
 
-    if (!(privinterface = testInterfaceObjFindByName(privconn, iface->name)))
+    if (!(obj = testInterfaceObjFindByName(privconn, iface->name)))
         goto cleanup;
 
-    virInterfaceObjRemove(&privconn->ifaces, privinterface);
+    virInterfaceObjRemove(&privconn->ifaces, obj);
     ret = 0;
 
  cleanup:
@@ -3940,25 +3940,25 @@ testInterfaceCreate(virInterfacePtr iface,
                     unsigned int flags)
 {
     testDriverPtr privconn = iface->conn->privateData;
-    virInterfaceObjPtr privinterface;
+    virInterfaceObjPtr obj;
     int ret = -1;
 
     virCheckFlags(0, -1);
 
-    if (!(privinterface = testInterfaceObjFindByName(privconn, iface->name)))
+    if (!(obj = testInterfaceObjFindByName(privconn, iface->name)))
         goto cleanup;
 
-    if (privinterface->active != 0) {
+    if (obj->active != 0) {
         virReportError(VIR_ERR_OPERATION_INVALID, NULL);
         goto cleanup;
     }
 
-    privinterface->active = 1;
+    obj->active = 1;
     ret = 0;
 
  cleanup:
-    if (privinterface)
-        virInterfaceObjUnlock(privinterface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     return ret;
 }
 
@@ -3968,25 +3968,25 @@ testInterfaceDestroy(virInterfacePtr iface,
                      unsigned int flags)
 {
     testDriverPtr privconn = iface->conn->privateData;
-    virInterfaceObjPtr privinterface;
+    virInterfaceObjPtr obj;
     int ret = -1;
 
     virCheckFlags(0, -1);
 
-    if (!(privinterface = testInterfaceObjFindByName(privconn, iface->name)))
+    if (!(obj = testInterfaceObjFindByName(privconn, iface->name)))
         goto cleanup;
 
-    if (privinterface->active == 0) {
+    if (obj->active == 0) {
         virReportError(VIR_ERR_OPERATION_INVALID, NULL);
         goto cleanup;
     }
 
-    privinterface->active = 0;
+    obj->active = 0;
     ret = 0;
 
  cleanup:
-    if (privinterface)
-        virInterfaceObjUnlock(privinterface);
+    if (obj)
+        virInterfaceObjUnlock(obj);
     return ret;
 }
 
-- 
2.9.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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