[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/12] json-lexer: make it safe to call multiple
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 08/12] json-lexer: make it safe to call multiple times |
Date: |
Tue, 17 Jul 2018 09:22:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Marc-André Lureau <address@hidden> writes:
> We can easily avoid the burden of checking if the lexer was
> initialized prior to calling destroy by the caller, let's do it.
>
> This allows simplification in state tracking in later patches of the
> qmp-async RFC series.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> qobject/json-lexer.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
> index 980ba159d6..0eaba43a2c 100644
> --- a/qobject/json-lexer.c
> +++ b/qobject/json-lexer.c
> @@ -386,5 +386,8 @@ int json_lexer_flush(JSONLexer *lexer)
>
> void json_lexer_destroy(JSONLexer *lexer)
> {
> - g_string_free(lexer->token, true);
> + if (lexer->token) {
> + g_string_free(lexer->token, true);
> + lexer->token = NULL;
> + }
> }
Is this just on general principles[*], or does it enable simplifactions
later in this series?
I asked the same question for its predecessor, and you answered
It allowed further simplification later in the series. I don't know if
this is still necessary after the rebase and other changes [...]
Do you have an updated answer?
- Re: [Qemu-devel] [PATCH 04/12] Revert "qmp: isolate responses into io thread", (continued)
[Qemu-devel] [PATCH 05/12] monitor: no need to save need_resume, Marc-André Lureau, 2018/07/06
[Qemu-devel] [PATCH 06/12] qga: process_event() simplification and leak fix, Marc-André Lureau, 2018/07/06
[Qemu-devel] [PATCH 08/12] json-lexer: make it safe to call multiple times, Marc-André Lureau, 2018/07/06
- Re: [Qemu-devel] [PATCH 08/12] json-lexer: make it safe to call multiple times,
Markus Armbruster <=
[Qemu-devel] [PATCH 09/12] tests: add a few qemu-qmp tests, Marc-André Lureau, 2018/07/06
[Qemu-devel] [PATCH 10/12] tests: add a qmp success-response test, Marc-André Lureau, 2018/07/06
[Qemu-devel] [PATCH 11/12] qga: process_event() simplification, Marc-André Lureau, 2018/07/06
[Qemu-devel] [PATCH 12/12] RFC: qmp: rework 'id' handling, Marc-André Lureau, 2018/07/06