[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/9] QJSON: Introduce qobject_from_json_va()
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 1/9] QJSON: Introduce qobject_from_json_va() |
Date: |
Fri, 13 Nov 2009 10:31:03 -0200 |
On Thu, 12 Nov 2009 15:39:14 -0600
Anthony Liguori <address@hidden> wrote:
> Luiz Capitulino wrote:
> > Accepts a va_list, will be used by QError.
> >
> > Signed-off-by: Luiz Capitulino <address@hidden>
> > ---
> > 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().
Right.
> > 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 <stdarg.h>
> >
>
> qemu-common.h is a better way to get stdarg.h
Why? I usually don't include qemu-common.h when all I need
are one or two headers.
- [Qemu-devel] [PATCH 0/9]: QError v3, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 1/9] QJSON: Introduce qobject_from_json_va(), Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 2/9] QString: Introduce qstring_append_chr(), Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 3/9] QString: Introduce qstring_append_int(), Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 4/9] Add qstring_append_chr() unit-test, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 5/9] Introduce QError, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 6/9] QJSON: Fix compile error, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 7/9] monitor: QError support, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 8/9] qdev: Use QError for 'device not found' error, Luiz Capitulino, 2009/11/12
- [Qemu-devel] [PATCH 9/9] monitor: do_info_balloon(): use QError, Luiz Capitulino, 2009/11/12