net: Convert net filter code to use object property iterators

Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Daniel P. Berrange 2015-10-13 13:37:44 +01:00 committed by Andreas Färber
parent 9a842f7d3c
commit 456fb0bfe0

View File

@ -137,6 +137,7 @@ static void netfilter_complete(UserCreatable *uc, Error **errp)
Error *local_err = NULL; Error *local_err = NULL;
char *str, *info; char *str, *info;
ObjectProperty *prop; ObjectProperty *prop;
ObjectPropertyIterator *iter;
StringOutputVisitor *ov; StringOutputVisitor *ov;
if (!nf->netdev_id) { if (!nf->netdev_id) {
@ -173,7 +174,8 @@ static void netfilter_complete(UserCreatable *uc, Error **errp)
QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next); QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next);
/* generate info str */ /* generate info str */
QTAILQ_FOREACH(prop, &OBJECT(nf)->properties, node) { iter = object_property_iter_init(OBJECT(nf));
while ((prop = object_property_iter_next(iter))) {
if (!strcmp(prop->name, "type")) { if (!strcmp(prop->name, "type")) {
continue; continue;
} }
@ -187,6 +189,7 @@ static void netfilter_complete(UserCreatable *uc, Error **errp)
g_free(str); g_free(str);
g_free(info); g_free(info);
} }
object_property_iter_free(iter);
} }
static void netfilter_finalize(Object *obj) static void netfilter_finalize(Object *obj)