From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NY4Nk-0005jo-JY for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:16:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NY4Nf-0005eD-SM for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:16:00 -0500 Received: from [199.232.76.173] (port=44118 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NY4Nf-0005e0-J2 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:15:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35763) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NY4Nf-0003Rn-6A for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:15:55 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0LLFsS7011826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jan 2010 16:15:54 -0500 Received: from localhost (vpn-9-176.rdu.redhat.com [10.11.9.176]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0LLFqvc002177 for ; Thu, 21 Jan 2010 16:15:53 -0500 From: Luiz Capitulino Date: Thu, 21 Jan 2010 19:15:39 -0200 Message-Id: <1264108541-4071-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1264108541-4071-1-git-send-email-lcapitulino@redhat.com> References: <1264108541-4071-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] QDict: Introduce qdict_get_qdict() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org A helper to retrieve a QDict from a QDict. Signed-off-by: Luiz Capitulino --- 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