Am 13.10.2015 um 14:37 schrieb Daniel P. Berrange:
> Stop directly accessing the Object "properties" field data

Object::properties 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 <berra...@redhat.com>
> ---
>  net/filter.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/filter.c b/net/filter.c
> index 326f2b5..1365bad 100644
> --- a/net/filter.c
> +++ b/net/filter.c
> @@ -137,6 +137,7 @@ static void netfilter_complete(UserCreatable *uc, Error 
> **errp)
>      Error *local_err = NULL;
>      char *str, *info;
>      ObjectProperty *prop;
> +    ObjectPropertyIterator *iter;
>      StringOutputVisitor *ov;
>  
>      if (!nf->netdev_id) {
> @@ -173,7 +174,8 @@ static void netfilter_complete(UserCreatable *uc, Error 
> **errp)
>      QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next);
>  
>      /* 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")) {
>              continue;
>          }
> @@ -187,6 +189,7 @@ static void netfilter_complete(UserCreatable *uc, Error 
> **errp)
>          g_free(str);
>          g_free(info);
>      }
> +    object_property_iter_free(iter);
>  }
>  
>  static void netfilter_finalize(Object *obj)

Reviewed-by: Andreas Färber <afaer...@suse.de>

CC'ing Stefan.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)

Reply via email to