From patchwork Sat Oct 17 13:36:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 36308 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 8D495B7088 for ; Sun, 18 Oct 2009 00:49:53 +1100 (EST) Received: from localhost ([127.0.0.1]:42112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz9fK-0002z6-Ra for incoming@patchwork.ozlabs.org; Sat, 17 Oct 2009 09:49:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mz9SN-0005op-OV for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mz9SH-0005lJ-Sn for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:26 -0400 Received: from [199.232.76.173] (port=58966 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz9SG-0005kk-Jv for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:21 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:48563) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mz9SG-0000Ok-8G for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:20 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9HDUQHP003286 for ; Sat, 17 Oct 2009 07:30:26 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n9HDaFvZ250286 for ; Sat, 17 Oct 2009 07:36:15 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9HDaEoA021626 for ; Sat, 17 Oct 2009 07:36:14 -0600 Received: from localhost.localdomain (sig-9-65-54-101.mts.ibm.com [9.65.54.101]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n9HDaBJI021369; Sat, 17 Oct 2009 07:36:14 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Sat, 17 Oct 2009 08:36:08 -0500 Message-Id: <1255786571-3528-9-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1255786571-3528-1-git-send-email-aliguori@us.ibm.com> References: <1255786571-3528-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 08/11] qjson: add %i for parsing bools 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 Not a wonderful choice in conversion characters but nothing else seems better. Signed-off-by: Anthony Liguori --- qjson.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/qjson.c b/qjson.c index ce2c942..9279bfb 100644 --- a/qjson.c +++ b/qjson.c @@ -339,6 +339,12 @@ static QObject *parse_number(JSONParserContext *ctxt, parse_error(ctxt, ptr, "invalid escape sequence"); goto out; } + } else if (*ptr == 'i') { + int val; + ptr++; + *length = ptr - data; + val = va_arg(*ap, int); + return QOBJECT(qbool_from_int(val)); } else if (*ptr == 'f') { double val; ptr++;