Skip to content

Commit b3e1d27

Browse files
committed
minor optimizations
1 parent 31d0319 commit b3e1d27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/include/cpp-json/json.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ inline std::string escape_string(NS::string_view s, Options options) {
13011301
if (shift_state.seen == 0) {
13021302

13031303
if ((ch & 0x80) == 0) {
1304-
switch (*it) {
1304+
switch (ch) {
13051305
case '\"':
13061306
r += "\\\"";
13071307
break;
@@ -1327,13 +1327,13 @@ inline std::string escape_string(NS::string_view s, Options options) {
13271327
r += "\\t";
13281328
break;
13291329
default:
1330-
if(!isprint(*it)) {
1330+
if(!isprint(ch)) {
13311331
r += "\\u";
13321332
char buf[5];
1333-
snprintf(buf, sizeof(buf), "%04X", *it);
1333+
snprintf(buf, sizeof(buf), "%04X", ch);
13341334
r += buf;
13351335
} else {
1336-
r += *it;
1336+
r += static_cast<char>(ch);
13371337
}
13381338
break;
13391339
}

0 commit comments

Comments
 (0)