summaryrefslogtreecommitdiff
path: root/ext/json/generator/generator.h
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-09-02 09:41:01 +0200
committerHiroshi SHIBATA <[email protected]>2024-10-03 14:20:34 +0900
commit630c681321cd247a55360e52743a5d706cd46bcb (patch)
treee6fb285bbbb4968b8c3139b17ccc4d057cbafb2d /ext/json/generator/generator.h
parent835ac8a4d7f01854dc45061301a1fc091f7bab3d (diff)
[flori/json] JSON.dump: avoid redundant UTF-8 validation
Given that we called `rb_enc_str_asciionly_p`, if the string encoding isn't valid UTF-8, we can't know it very cheaply by checking the encoding and coderange that was just computed by Ruby, rather than to do it ourselves. Also Ruby might have already computed that earlier. https://github.com/flori/json/commit/4b04c469d5
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11775
Diffstat (limited to 'ext/json/generator/generator.h')
-rw-r--r--ext/json/generator/generator.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h
index 98b7d833f3..8dde7be827 100644
--- a/ext/json/generator/generator.h
+++ b/ext/json/generator/generator.h
@@ -46,7 +46,6 @@ static const int halfShift = 10; /* used for shifting by 10 bits */
static const UTF32 halfBase = 0x0010000UL;
static const UTF32 halfMask = 0x3FFUL;
-static unsigned char isLegalUTF8(const UTF8 *source, unsigned long length);
static void unicode_escape(char *buf, UTF16 character);
static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16 character);
static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char script_safe);