Am 17.12.2015 um 09:54 schrieb Markus Armbruster:
> "Daniel P. Berrange" <berra...@redhat.com> writes:
> 
>> Currently the object property 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: Eric Blake <ebl...@redhat.com>
>> Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
> [...]
>> diff --git a/include/qom/object.h b/include/qom/object.h
>> index 9630c5b..275a21b 100644
>> --- a/include/qom/object.h
>> +++ b/include/qom/object.h
>> @@ -971,6 +971,11 @@ ObjectProperty *object_class_property_find(ObjectClass 
>> *klass, const char *name,
>>  
>>  typedef struct ObjectPropertyIterator ObjectPropertyIterator;
>>  
>> +struct ObjectPropertyIterator {
>> +    ObjectClass *nextclass;
>> +    GHashTableIter iter;
>> +};
>> +
> 
> Please fuse the two declarations.  Perhaps Andreas can do that on
> commit.

Done.

>>  /**
>>   * object_property_iter_init:
>>   * @obj: the object
> 
> Reviewed-by: Markus Armbruster <arm...@redhat.com>

Queued on qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Thanks,
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