diff options
author | Luke T. Shumaker <[email protected]> | 2024-02-22 20:51:28 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-10-08 14:10:05 +0900 |
commit | 74d459fd52ef85f92f7c20819afcc4ffcf11714d (patch) | |
tree | c967d95e7b5f20bc32956087368571e831f7ded6 /test | |
parent | 6e47968929f2ee77376d28a6561266d8f8e3a4f7 (diff) |
[ruby/json] Adjust to the CVTUTF code being gone
I, Luke T. Shumaker, am the sole author of the added code.
I did not reference CVTUTF when writing it. I did reference the
Unicode standard (15.0.0), the Wikipedia article on UTF-8, and the
Wikipedia article on UTF-16. When I saw some tests fail, I did
reference the old deleted code (but a JSON-specific part, inherently
not as based on CVTUTF) to determine that script_safe should also
escape U+2028 and U+2029.
I targeted simplicity and clarity when writing the code--it can likely
be optimized. In my mind, the obvious next optimization is to have it
combine contiguous non-escaped characters into just one call to
fbuffer_append(), instead of calling fbuffer_append() for each
character.
Regarding the use of the "modern" types `uint32_t`, `uint16_t`, and
`bool`:
- ruby.h is guaranteed to give us uint32_t and uint16_t.
- Since Ruby 3.0.0, ruby.h is guaranteed to give us bool... but we
support down to Ruby 2.3. But, ruby.h is guaranteed to give us
HAVE_STDBOOL_H for the C99 stdbool.h; so use that to include
stdbool.h if we can, and if not then fall back to a copy of the
same bool definition that Ruby 3.0.5 uses with C89.
https://github.com/ruby/json/commit/c96351f874
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions