Skip to content

Commit d4297de

Browse files
committed
code layout
1 parent 8d5a381 commit d4297de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/json/json_encoder.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ zend_result php_json_escape_string(
673673
#endif
674674

675675
us = (unsigned char)s[pos];
676-
if (result != PHP_JSON_NON_ASCII && EXPECTED(!ZEND_BIT_TEST(charmap, us))) {
676+
if (EXPECTED(result != PHP_JSON_NON_ASCII && !ZEND_BIT_TEST(charmap, us))) {
677677
pos++;
678678
len--;
679679
} else {
@@ -727,22 +727,22 @@ zend_result php_json_escape_string(
727727
ZEND_ASSERT(buf->s);
728728

729729
/* From http://en.wikipedia.org/wiki/UTF16 */
730+
dst = smart_str_extend(buf, 6 + ((us >= 0x10000) ? 6 : 0));
730731
if (us >= 0x10000) {
731732
unsigned int next_us;
732733

733734
us -= 0x10000;
734735
next_us = (unsigned short)((us & 0x3ff) | 0xdc00);
735736
us = (unsigned short)((us >> 10) | 0xd800);
736-
dst = smart_str_extend(buf, 6);
737737
dst[0] = '\\';
738738
dst[1] = 'u';
739739
dst[2] = digits[(us >> 12) & 0xf];
740740
dst[3] = digits[(us >> 8) & 0xf];
741741
dst[4] = digits[(us >> 4) & 0xf];
742742
dst[5] = digits[us & 0xf];
743743
us = next_us;
744+
dst += 6;
744745
}
745-
dst = smart_str_extend(buf, 6);
746746
dst[0] = '\\';
747747
dst[1] = 'u';
748748
dst[2] = digits[(us >> 12) & 0xf];

0 commit comments

Comments
 (0)