in include/yyjson/yyjson.h [4535:4570]
yyjson_api_inline bool unsafe_yyjson_is_str_noesc(const char *str, size_t len) {
#if YYJSON_HAS_CONSTANT_P && \
(!YYJSON_IS_REAL_GCC || yyjson_gcc_available(4, 4, 0))
if (yyjson_constant_p(len) && len <= 32) {
/*
Same as the following loop:
for (size_t i = 0; i < len; i++) {
char c = str[i];
if (c < ' ' || c > '~' || c == '"' || c == '\\') return false;
}
GCC evaluates it at compile time only if the string length is within 17
and -O3 (which turns on the -fpeel-loops flag) is used.
So the loop is unrolled for GCC.
*/
# define yyjson_repeat32_incr(x) \
x(0) x(1) x(2) x(3) x(4) x(5) x(6) x(7) \
x(8) x(9) x(10) x(11) x(12) x(13) x(14) x(15) \
x(16) x(17) x(18) x(19) x(20) x(21) x(22) x(23) \
x(24) x(25) x(26) x(27) x(28) x(29) x(30) x(31)
# define yyjson_check_char_noesc(i) \
if (i < len) { \
char c = str[i]; \
if (c < ' ' || c > '~' || c == '"' || c == '\\') return false; }
yyjson_repeat32_incr(yyjson_check_char_noesc)
# undef yyjson_repeat32_incr
# undef yyjson_check_char_noesc
return true;
}
#else
(void)str;
(void)len;
#endif
return false;
}