Re: [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
On Wed, Mar 24, 2010 at 11:12:05PM +0800, Amos Kong wrote: When input some invialid word 'unknowcmd' through QMP port, qemu outputs this error message: parse error: invalid keyword `%s' This patch makes qemu output the content of invalid keyword, like: parse error: invalid keyword `unknowcmd' Thanks, applied. Signed-off-by: Amos Kong ak...@redhat.com --- json-parser.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/json-parser.c b/json-parser.c index 579928f..b55d763 100644 --- a/json-parser.c +++ b/json-parser.c @@ -12,6 +12,7 @@ */ #include stdbool.h +#include stdarg.h #include qemu-common.h #include qstring.h @@ -93,7 +94,12 @@ static int token_is_escape(QObject *obj, const char *value) */ static void parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) { -fprintf(stderr, parse error: %s\n, msg); +va_list ap; +va_start(ap, msg); +fprintf(stderr, parse error: ); +vfprintf(stderr, msg, ap); +fprintf(stderr, \n); +va_end(ap); } /** -- 1.6.3.3 -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
[Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
When input some invialid words in QMP port, qemu outputs this error message: parse error: invalid keyword `%s' This patch makes qemu output the content, like: parse error: invalid keyword `unknow_cmd' Signed-off-by: Amos Kong ak...@redhat.com --- json-parser.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/json-parser.c b/json-parser.c index 579928f..98a82af 100644 --- a/json-parser.c +++ b/json-parser.c @@ -12,6 +12,7 @@ */ #include stdbool.h +#include stdarg.h #include qemu-common.h #include qstring.h @@ -93,7 +94,11 @@ static int token_is_escape(QObject *obj, const char *value) */ static void parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) { -fprintf(stderr, parse error: %s\n, msg); +va_list ap; +va_start(ap, msg); +fprintf(stderr, parse error: ); +vfprintf(stderr, msg, ap); +fprintf(stderr, \n); } /** -- 1.5.5.6
Re: [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
Amos Kong ak...@redhat.com writes: When input some invialid word 'unknowcmd' through QMP port, qemu outputs this error message: parse error: invalid keyword `%s' This patch makes qemu output the content of invalid keyword, like: parse error: invalid keyword `unknowcmd' Signed-off-by: Amos Kong ak...@redhat.com Looks good to me. Hint: it's best to put a version in the subject when you respin, like [PATCH v2] ...
Re: [Qemu-devel] [PATCH] qemu: jaso-parser: Output the content of invalid keyword
On Wed, 24 Mar 2010 17:00:14 +0100 Markus Armbruster arm...@redhat.com wrote: Amos Kong ak...@redhat.com writes: When input some invialid word 'unknowcmd' through QMP port, qemu outputs this error message: parse error: invalid keyword `%s' This patch makes qemu output the content of invalid keyword, like: parse error: invalid keyword `unknowcmd' Signed-off-by: Amos Kong ak...@redhat.com Looks good to me. Hint: it's best to put a version in the subject when you respin, like [PATCH v2] ... Yes, and maintainers may miss a patch down a thread (and it's a good opportunity to fix the subject).