[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where a
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate |
Date: |
Fri, 29 Apr 2016 15:25:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> No need to create a temporary buffer, when we already have a
> function available for our needs.
>
> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: Fam Zheng <address@hidden>
>
> ---
> v3: no change
> v2: no change
> ---
> qobject/json-parser.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/qobject/json-parser.c b/qobject/json-parser.c
> index c18e48a..5fbaf58 100644
> --- a/qobject/json-parser.c
> +++ b/qobject/json-parser.c
> @@ -204,12 +204,7 @@ static QString
> *qstring_from_escaped_str(JSONParserContext *ctxt,
> goto out;
> }
> } else {
> - char dummy[2];
> -
> - dummy[0] = *ptr++;
> - dummy[1] = 0;
> -
> - qstring_append(str, dummy);
> + qstring_append_chr(str, *ptr++);
> }
> }
The function has several qstring_append(str, S) where S consists of a
single character. They could all be converted to qstring_append_chr().
- [Qemu-devel] [PATCH v3 00/18] Add qapi-to-JSON and clone visitors, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate, Eric Blake, 2016/04/29
- Re: [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate,
Markus Armbruster <=
- [Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 09/18] Revert "qjson: Simplify by using json-output-visitor", Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 08/18] qjson: Simplify by using json-output-visitor, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 02/18] qapi: Improve use of qmp/types.h, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 06/18] qapi: Add qstring_append_format(), Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 01/18] qapi: Rename (one) qjson.h to qobject-json.h, Eric Blake, 2016/04/29