qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH 2/5] QDict: Introduce qdict_get_qdict()
Date: Tue,  5 Jan 2010 18:34:55 -0200	[thread overview]
Message-ID: <1262723698-23658-3-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1262723698-23658-1-git-send-email-lcapitulino@redhat.com>

A helper to retrieve a QDict from a QDict.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qdict.c |   13 +++++++++++++
 qdict.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/qdict.c b/qdict.c
index ba8eef0..c6a5a42 100644
--- a/qdict.c
+++ b/qdict.c
@@ -216,6 +216,19 @@ QList *qdict_get_qlist(const QDict *qdict, const char *key)
 }
 
 /**
+ * qdict_get_qdict(): Get the QDict mapped by 'key'
+ *
+ * This function assumes that 'key' exists and it stores a
+ * QDict object.
+ *
+ * Return QDict mapped by 'key'.
+ */
+QDict *qdict_get_qdict(const QDict *qdict, const char *key)
+{
+    return qobject_to_qdict(qdict_get_obj(qdict, key, QTYPE_QDICT));
+}
+
+/**
  * qdict_get_str(): Get a pointer to the stored string mapped
  * by 'key'
  *
diff --git a/qdict.h b/qdict.h
index 5fef1ea..2eaf6d5 100644
--- a/qdict.h
+++ b/qdict.h
@@ -40,6 +40,7 @@ void qdict_iter(const QDict *qdict,
 int64_t qdict_get_int(const QDict *qdict, const char *key);
 int qdict_get_bool(const QDict *qdict, const char *key);
 QList *qdict_get_qlist(const QDict *qdict, const char *key);
+QDict *qdict_get_qdict(const QDict *qdict, const char *key);
 const char *qdict_get_str(const QDict *qdict, const char *key);
 int64_t qdict_get_try_int(const QDict *qdict, const char *key,
                           int64_t err_value);
-- 
1.6.6

  parent reply	other threads:[~2010-01-05 20:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 20:34 [Qemu-devel] [PATCH v0 0/5]: Convert pci_info() to QObject Luiz Capitulino
2010-01-05 20:34 ` [Qemu-devel] [PATCH 1/5] QList: Introduce QLIST_FOREACH_ENTRY() Luiz Capitulino
2010-01-05 20:34 ` Luiz Capitulino [this message]
2010-01-05 20:34 ` [Qemu-devel] [PATCH 3/5] PCI: Convert pci_info() to QObject Luiz Capitulino
2010-01-07 15:19   ` [Qemu-devel] " Anthony Liguori
2010-01-07 18:00     ` Luiz Capitulino
2010-01-05 20:34 ` [Qemu-devel] [PATCH 4/5] PCI: do_pci_info(): PCI bridge support Luiz Capitulino
2010-01-05 20:34 ` [Qemu-devel] [PATCH 5/5] PCI: do_pci_info(): PCI bridge devices support Luiz Capitulino
  -- strict thread matches above, loose matches on Subject: below --
2010-01-08 18:42 [Qemu-devel] [PATCH v1 0/5]: Convert pci_info() to QObject Luiz Capitulino
2010-01-08 18:42 ` [Qemu-devel] [PATCH 2/5] QDict: Introduce qdict_get_qdict() Luiz Capitulino
2010-01-20 16:39 [Qemu-devel] [PATCH v2 0/5]: Convert pci_info() to QObject Luiz Capitulino
2010-01-20 16:39 ` [Qemu-devel] [PATCH 2/5] QDict: Introduce qdict_get_qdict() Luiz Capitulino

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=1262723698-23658-3-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=mst@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).