qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.com>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qom: change object property iterator API contract
Date: Tue, 8 Dec 2015 09:05:52 -0700	[thread overview]
Message-ID: <5666FFE0.10703@redhat.com> (raw)
In-Reply-To: <1448638055-22113-1-git-send-email-berrange@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2607 bytes --]

On 11/27/2015 08:27 AM, Daniel P. Berrange wrote:
> 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))) {
>      ...
>   }
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> 
> NB, this patch is not against master, it is intended to apply
> after
> 
>   "qom: allow properties to be registered against classes"
> 
> which is queued in qom-next for 2.6
> 
>  hw/ppc/spapr_drc.c         |  7 +++----
>  include/qom/object.h       | 42 +++++++++++++++++++++++++++---------------
>  net/filter.c               |  7 +++----
>  qmp.c                      | 14 ++++++--------
>  qom/object.c               | 22 ++++------------------
>  tests/check-qom-proplist.c |  7 +++----
>  vl.c                       |  7 +++----
>  7 files changed, 49 insertions(+), 57 deletions(-)
> 

> +++ b/include/qom/object.h
> @@ -346,6 +346,7 @@ typedef struct ObjectProperty
>      void *opaque;
>  } ObjectProperty;
>  
> +
>  /**
>   * ObjectUnparent:
>   * @obj: the object that is being removed from the composition tree

Spurious whitespace change?


>  
> + /**
> + * object_property_iter_free:
> + * @iter: the iterator instance
> + *
> + * Releases any resources associated with the iterator. It is
> + * not necessary to call this method if object_property_iter_next
> + * has returned %NULL. It is only required if an application wishes
> + * to abort iteration before it is complete
> + */
> +void object_property_iter_free(ObjectPropertyIterator *iter);
> +

Huh? Why is this being added?  I thought the point was to get rid of the
need for object_property_iter_free().

> +++ b/qom/object.c
> @@ -67,11 +67,6 @@ struct TypeImpl

Other than that snafu, everything else looked fine.   If that's all you
fix for v2, you can add:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-12-08 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 15:27 [Qemu-devel] [PATCH] qom: change object property iterator API contract Daniel P. Berrange
2015-12-08 16:05 ` Eric Blake [this message]
2015-12-09 12:29   ` Daniel P. Berrange

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=5666FFE0.10703@redhat.com \
    --to=eblake@redhat.com \
    --cc=afaerber@suse.com \
    --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).