[PATCH 07/17] nwfilter: Add @def into virNWFilterObjNew

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

 



Modify the virNWFilterObjNew to take @def as a parameter and consume it.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/virnwfilterobj.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index ac99f47..c86b1a9 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -51,7 +51,7 @@ struct _virNWFilterObjList {
 
 
 static virNWFilterObjPtr
-virNWFilterObjNew(void)
+virNWFilterObjNew(virNWFilterDefPtr def)
 {
     virNWFilterObjPtr obj;
 
@@ -66,6 +66,8 @@ virNWFilterObjNew(void)
     }
 
     virNWFilterObjLock(obj);
+    obj->def = def;
+
     return obj;
 }
 
@@ -361,20 +363,21 @@ virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
         return obj;
     }
 
-    if (!(obj = virNWFilterObjNew()))
+    if (!(obj = virNWFilterObjNew(def)))
         return NULL;
+    def = NULL;
+    objdef = obj->def;
 
-    if (!(obj->configFile = virFileBuildPath(configDir, def->name, ".xml")))
+    if (!(obj->configFile = virFileBuildPath(configDir, objdef->name, ".xml")))
         goto error;
 
     if (VIR_APPEND_ELEMENT_COPY(nwfilters->objs, nwfilters->count, obj) < 0)
         goto error;
 
-    obj->def = def;
-
     return obj;
 
  error:
+    obj->def = NULL;
     virNWFilterObjUnlock(obj);
     virNWFilterObjFree(obj);
     return NULL;
-- 
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