[libvirt] [PATCH 07/17] nwfilter: Add @def into virNWFilterObjNew
John Ferlan
jferlan at redhat.com
Fri Jun 2 10:25:28 UTC 2017
Modify the virNWFilterObjNew to take @def as a parameter and consume it.
Signed-off-by: John Ferlan <jferlan at redhat.com>
---
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
More information about the libvir-list
mailing list