qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v5 05/26] qjson: add "opaque" field to JSONMessage


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC v5 05/26] qjson: add "opaque" field to JSONMessageParser
Date: Wed, 13 Dec 2017 15:37:02 +0000
User-agent: Mutt/1.9.1 (2017-09-22)

On Tue, Dec 05, 2017 at 01:51:39PM +0800, Peter Xu wrote:
> diff --git a/qga/main.c b/qga/main.c
> index 62a62755bd..3b5ebbc1ee 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -593,7 +593,8 @@ static void process_command(GAState *s, QDict *req)
>  }
>  
>  /* handle requests/control events coming in over the channel */
> -static void process_event(JSONMessageParser *parser, GQueue *tokens)
> +static void process_event(JSONMessageParser *parser, GQueue *tokens,
> +                          void *opaque)
>  {
>      GAState *s = container_of(parser, GAState, parser);
>      QDict *qdict;
> @@ -1320,7 +1321,7 @@ static int run_agent(GAState *s, GAConfig *config, int 
> socket_activation)
>      s->command_state = ga_command_state_new();
>      ga_command_state_init(s, s->command_state);
>      ga_command_state_init_all(s->command_state);
> -    json_message_parser_init(&s->parser, process_event);
> +    json_message_parser_init(&s->parser, process_event, NULL);

This patch leaves the code with 2 ways of getting at state from the
parser pointer:
1. Use container_of() like existing users.
2. Use the new (unused) opaque argument.

Given that #1 exists, is this patch really necessary?

Please explain in the commit description, don't make me look ahead in
the patch series.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]