On 04/29/2016 06:09 AM, Markus Armbruster wrote:
> Eric Blake <ebl...@redhat.com> 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 <ebl...@redhat.com>
>> Reviewed-by: Fam Zheng <f...@redhat.com>

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to