From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8hO0-0004Fr-HB for qemu-devel@nongnu.org; Thu, 12 Nov 2009 16:39:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8hNv-00047j-GZ for qemu-devel@nongnu.org; Thu, 12 Nov 2009 16:39:23 -0500 Received: from [199.232.76.173] (port=59330 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8hNv-00047V-Aw for qemu-devel@nongnu.org; Thu, 12 Nov 2009 16:39:19 -0500 Received: from qw-out-1920.google.com ([74.125.92.150]:6714) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8hNv-0006zP-2Y for qemu-devel@nongnu.org; Thu, 12 Nov 2009 16:39:19 -0500 Received: by qw-out-1920.google.com with SMTP id 5so505201qwc.4 for ; Thu, 12 Nov 2009 13:39:17 -0800 (PST) Message-ID: <4AFC8082.8060402@codemonkey.ws> Date: Thu, 12 Nov 2009 15:39:14 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/9] QJSON: Introduce qobject_from_json_va() References: <1258058554-22872-1-git-send-email-lcapitulino@redhat.com> <1258058554-22872-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1258058554-22872-2-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: armbru@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com Luiz Capitulino wrote: > Accepts a va_list, will be used by QError. > > Signed-off-by: Luiz Capitulino > --- > qjson.c | 14 ++++++++++++++ > qjson.h | 2 ++ > 2 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/qjson.c b/qjson.c > index 7270909..491b61e 100644 > --- a/qjson.c > +++ b/qjson.c > @@ -64,6 +64,20 @@ QObject *qobject_from_jsonf(const char *string, ...) > return state.result; > } > > +QObject *qobject_from_json_va(const char *string, va_list *ap) > +{ > + JSONParsingState state = {}; > + > + state.ap = ap; > + > + json_message_parser_init(&state.parser, parse_json); > + json_message_parser_feed(&state.parser, string, strlen(string)); > + json_message_parser_flush(&state.parser); > + json_message_parser_destroy(&state.parser); > + > + return state.result; > +} > + > qobject_from_jsonf() should just call qobject_from_json_va(). > typedef struct ToJsonIterState > { > int count; > diff --git a/qjson.h b/qjson.h > index 7fce742..8b89e41 100644 > --- a/qjson.h > +++ b/qjson.h > @@ -14,12 +14,14 @@ > #ifndef QJSON_H > #define QJSON_H > > +#include > qemu-common.h is a better way to get stdarg.h > #include "qobject.h" > #include "qstring.h" > > QObject *qobject_from_json(const char *string); > QObject *qobject_from_jsonf(const char *string, ...) > __attribute__((__format__ (__printf__, 1, 2))); > +QObject *qobject_from_json_va(const char *string, va_list *ap); > > QString *qobject_to_json(const QObject *obj); > > Regards, Anthony Liguori