Message ID | 1402392027-9164-2-git-send-email-arei.gonglei@huawei.com |
---|---|
State | New |
Headers | show |
On 06/10/2014 03:20 AM, arei.gonglei@huawei.com wrote: > From: Gonglei <arei.gonglei@huawei.com> > > Signed-off-by: ChenLiang <chenliang88@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > qobject/json-parser.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) Reviewed-by: Eric Blake <eblake@redhat.com> > @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); Does the compiler warn if you drop the cast-to-void? I tend to think of it as fluff that usually doesn't add anything.
On Tue, 10 Jun 2014 17:20:24 +0800 <arei.gonglei@huawei.com> wrote: > From: Gonglei <arei.gonglei@huawei.com> > > Signed-off-by: ChenLiang <chenliang88@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> Applied to the qmp branch, thanks. > --- > qobject/json-parser.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/qobject/json-parser.c b/qobject/json-parser.c > index e46c264..4288267 100644 > --- a/qobject/json-parser.c > +++ b/qobject/json-parser.c > @@ -423,7 +423,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > if (!token_is_operator(token, '{')) { > goto out; > } > - token = NULL; > > dict = qdict_new(); > > @@ -449,7 +448,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > parse_error(ctxt, token, "expected separator in dict"); > goto out; > } > - token = NULL; > > if (parse_pair(ctxt, dict, ap) == -1) { > goto out; > @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(dict); > @@ -487,10 +483,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > } > > if (!token_is_operator(token, '[')) { > - token = NULL; > goto out; > } > - token = NULL; > > list = qlist_new(); > > @@ -523,8 +517,6 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > > - token = NULL; > - > obj = parse_value(ctxt, ap); > if (obj == NULL) { > parse_error(ctxt, token, "expecting value"); > @@ -539,11 +531,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(list);
diff --git a/qobject/json-parser.c b/qobject/json-parser.c index e46c264..4288267 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -423,7 +423,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) if (!token_is_operator(token, '{')) { goto out; } - token = NULL; dict = qdict_new(); @@ -449,7 +448,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) parse_error(ctxt, token, "expected separator in dict"); goto out; } - token = NULL; if (parse_pair(ctxt, dict, ap) == -1) { goto out; @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) goto out; } } - token = NULL; } else { - token = parser_context_pop_token(ctxt); - token = NULL; + (void)parser_context_pop_token(ctxt); } return QOBJECT(dict); @@ -487,10 +483,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) } if (!token_is_operator(token, '[')) { - token = NULL; goto out; } - token = NULL; list = qlist_new(); @@ -523,8 +517,6 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) goto out; } - token = NULL; - obj = parse_value(ctxt, ap); if (obj == NULL) { parse_error(ctxt, token, "expecting value"); @@ -539,11 +531,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) goto out; } } - - token = NULL; } else { - token = parser_context_pop_token(ctxt); - token = NULL; + (void)parser_context_pop_token(ctxt); } return QOBJECT(list);