[Top][All Lists]

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping
Date: Tue, 03 May 2016 09:36:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> 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?

I think the name is fine.

If you strongly prefer to encode the source file in the identifier, you
could use qobject_json_string_append_to_qstring(), but that's even
longer, and less clear.

reply via email to

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