[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping |
Date: |
Fri, 29 Apr 2016 11:57:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 04/29/2016 06:09 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> Pull out a new qstring_append_json_string() helper, so that all
>> JSON output producers can use the same output escaping rules.
>>
>> While it appears that vmstate's use of the simpler qjson.c
>> formatter is not currently encountering any string that needs
>> escapes to be valid JSON, it is better to be safe than sorry.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>> Reviewed-by: Fam Zheng <address@hidden>
>> - qstring_append(str, "\"");
>> + qstring_append_json_string(str, qstring_get_str(val));
>> break;
> I think this belongs to qobject-json.c, because it's very much about
> JSON (it encapsulates knowledge on JSON string escaping), and a mere
> user of QString (it knows nothing about QString's implementation).
>
> Precedence: qobject_from_json() & friends are there, not in qobject.c.
Fair enough. Does the name qstring_append_json_string() still work, or
do I need to adjust the name to something with 'qobject' in there, to
make it easier to know which header and .c file to use for the function?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [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
- [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
- [Qemu-devel] [PATCH v3 11/18] qjson: Remove unused file, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v3 16/18] sockets: Use new QAPI cloning, Eric Blake, 2016/04/29