Skip to content

Commit d9a42c2

Browse files
committed
Remove unnecessary conditional in escape_UTF8_char_basic.
1 parent 6b05990 commit d9a42c2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

ext/json/ext/generator/generator.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,11 @@ static inline FORCE_INLINE void escape_UTF8_char_basic(search_state *search)
189189
case '\r': fbuffer_append(search->buffer, "\\r", 2); break;
190190
case '\t': fbuffer_append(search->buffer, "\\t", 2); break;
191191
default: {
192-
if (ch < ' ') {
193-
const char *hexdig = "0123456789abcdef";
194-
char scratch[6] = { '\\', 'u', '0', '0', 0, 0 };
195-
scratch[4] = hexdig[(ch >> 4) & 0xf];
196-
scratch[5] = hexdig[ch & 0xf];
197-
fbuffer_append(search->buffer, scratch, 6);
198-
} else {
199-
fbuffer_append_char(search->buffer, ch);
200-
}
192+
const char *hexdig = "0123456789abcdef";
193+
char scratch[6] = { '\\', 'u', '0', '0', 0, 0 };
194+
scratch[4] = hexdig[(ch >> 4) & 0xf];
195+
scratch[5] = hexdig[ch & 0xf];
196+
fbuffer_append(search->buffer, scratch, 6);
201197
break;
202198
}
203199
}

0 commit comments

Comments
 (0)