qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Markus Armbruster <armbru@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qom: change object property iterator API contract
Date: Mon, 11 Jan 2016 16:29:28 +0100	[thread overview]
Message-ID: <5693CA58.8080901@suse.de> (raw)
In-Reply-To: <877fkdzc89.fsf@blackfin.pond.sub.org>

Am 17.12.2015 um 09:54 schrieb Markus Armbruster:
> "Daniel P. Berrange" <berrange@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 <eblake@redhat.com>
>> Signed-off-by: Daniel P. Berrange <berrange@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 <armbru@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	other threads:[~2016-01-11 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 12:34 [Qemu-devel] [PATCH v2] qom: change object property iterator API contract Daniel P. Berrange
2015-12-17  8:54 ` Markus Armbruster
2016-01-11 15:29   ` Andreas Färber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5693CA58.8080901@suse.de \
    --to=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).