From patchwork Fri Jan 8 18:42:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 42528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24E93B7BC3 for ; Sat, 9 Jan 2010 05:49:20 +1100 (EST) Received: from localhost ([127.0.0.1]:45779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTJt6-0005qJ-VN for incoming@patchwork.ozlabs.org; Fri, 08 Jan 2010 13:48:45 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTJnA-0008Lb-Kf for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:42:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTJn6-0008EG-8z for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:42:36 -0500 Received: from [199.232.76.173] (port=47705 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTJn5-0008E3-Oe for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:42:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16476) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTJn5-0007Ph-8p for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:42:31 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o08IgUGK006582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Jan 2010 13:42:30 -0500 Received: from localhost (vpn-9-144.rdu.redhat.com [10.11.9.144]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o08IgSlJ015546; Fri, 8 Jan 2010 13:42:29 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 8 Jan 2010 16:42:13 -0200 Message-Id: <1262976136-31852-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1262976136-31852-1-git-send-email-lcapitulino@redhat.com> References: <1262976136-31852-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 2/5] QDict: Introduce qdict_get_qdict() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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);