Skip to content

Commit 0bfe7cc

Browse files
authored
Merge pull request #795 from samyron/sm/remove-unnecessary-conditional
Remove unnecessary conditional in escape_UTF8_char_basic.
2 parents 410d3ed + d9a42c2 commit 0bfe7cc

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

ext/json/ext/generator/generator.c

+5-9
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)