]> git.ipfire.org Git - thirdparty/gcc.git/commit
json: fix escaping of object keys
authorDavid Malcolm <dmalcolm@redhat.com>
Sat, 16 Dec 2023 21:16:33 +0000 (16:16 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Sat, 16 Dec 2023 21:16:33 +0000 (16:16 -0500)
commit30d9a3a69841b13ac01397cf879a043c39409572
tree6d57dcd78003d67a5beb0ab5a2a495cf07925d32
parent308e9d693cb8499f46357ca882414b85f2ba6a1e
json: fix escaping of object keys

gcc/ChangeLog:
* json.cc (print_escaped_json_string): New, taken from
string::print.
(object::print): Use it for printing keys.
(string::print): Move implementation to
print_escaped_json_string.
(selftest::test_writing_objects): Add a key containing
quote, backslash, and control characters.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/json.cc