From patchwork Sat Oct 17 13:36:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08/11] qjson: add %i for parsing bools Date: Sat, 17 Oct 2009 03:36:08 -0000 From: Anthony Liguori X-Patchwork-Id: 36308 Message-Id: <1255786571-3528-9-git-send-email-aliguori@us.ibm.com> To: qemu-devel@nongnu.org Cc: Anthony Liguori 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++;