From: Anthony Liguori <anthony@codemonkey.ws>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4] QList: Introduce QLIST_FOREACH_ENTRY()
Date: Tue, 26 Jan 2010 16:05:45 -0600 [thread overview]
Message-ID: <4B5F6739.8010805@codemonkey.ws> (raw)
In-Reply-To: <1264108541-4071-2-git-send-email-lcapitulino@redhat.com>
On 01/21/2010 03:15 PM, Luiz Capitulino wrote:
> Iterate over QList entries, it's needed to call qlist_entry_obj()
> to retrieve the stored QObject.
>
> I'm not sure if it's ok to have this, because it's not as easy as
> qlist_iter() and the QListEntry data type is now exposed to the
> users, which means we have one more struct to be maintained when
> we have libqmp.
>
> Adding anyway, as it's more compact and people are asking for it.
>
> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
>
Applied all. Thanks.
Regards,
Anthony Liguori
> ---
> qlist.h | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/qlist.h b/qlist.h
> index afdc446..a3261e1 100644
> --- a/qlist.h
> +++ b/qlist.h
> @@ -29,6 +29,16 @@ typedef struct QList {
> #define qlist_append(qlist, obj) \
> qlist_append_obj(qlist, QOBJECT(obj))
>
> +#define QLIST_FOREACH_ENTRY(qlist, var) \
> + for ((var) = ((qlist)->head.tqh_first); \
> + (var); \
> + (var) = ((var)->next.tqe_next))
> +
> +static inline QObject *qlist_entry_obj(const QListEntry *entry)
> +{
> + return entry->value;
> +}
> +
> QList *qlist_new(void);
> QList *qlist_copy(QList *src);
> void qlist_append_obj(QList *qlist, QObject *obj);
>
next prev parent reply other threads:[~2010-01-26 22:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 21:15 [Qemu-devel] [PATCH v3 0/4]: Convert pci_info() to QObject Luiz Capitulino
2010-01-21 21:15 ` [Qemu-devel] [PATCH 1/4] QList: Introduce QLIST_FOREACH_ENTRY() Luiz Capitulino
2010-01-26 22:05 ` Anthony Liguori [this message]
2010-01-21 21:15 ` [Qemu-devel] [PATCH 2/4] QDict: Introduce qdict_get_qdict() Luiz Capitulino
2010-01-21 21:15 ` [Qemu-devel] [PATCH 3/4] PCI: Convert pci_info() to QObject Luiz Capitulino
2010-01-21 21:15 ` [Qemu-devel] [PATCH 4/4] PCI: do_pci_info(): PCI bridge devices support Luiz Capitulino
2010-01-22 10:03 ` [Qemu-devel] [PATCH v3 0/4]: Convert pci_info() to QObject Markus Armbruster
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=4B5F6739.8010805@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=lcapitulino@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.