• D
    qom: Change object property iterator API contract · 7746abd8
    Daniel P. Berrange 提交于
    Currently the ObjectProperty iterator API works as follows:
    
      ObjectPropertyIterator *iter;
    
      iter = object_property_iter_init(obj);
      while ((prop = object_property_iter_next(iter))) {
         ...
      }
      object_property_iter_free(iter);
    
    This has the benefit that the ObjectPropertyIterator struct
    can be opaque, but has the downside that callers need to
    explicitly call a free function. It is also not in keeping
    with iterator style used elsewhere in QEMU/GLib2.
    
    This patch changes the API to use stack allocation instead:
    
      ObjectPropertyIterator iter;
    
      object_property_iter_init(&iter, obj);
      while ((prop = object_property_iter_next(&iter))) {
         ...
      }
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
    Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
    [AF: Fused ObjectPropertyIterator struct with typedef]
    Signed-off-by: NAndreas Färber <afaerber@suse.de>
    7746abd8
vl.c 133.6 KB