Skip to content

Commit c4b17be

Browse files
committed
using modern for loop
minor formatting
1 parent f2b08bc commit c4b17be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/include/cpp-json/json.tcc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ inline std::string escape_string(const std::string &s, unsigned options) {
191191
r += *it;
192192
break;
193193
}
194-
}else if((ch & 0xe0) == 0xc0) {
194+
} else if((ch & 0xe0) == 0xc0) {
195195
// 2 byte
196196
result = ch & 0x1f;
197197
shift_state.expected = 2;
@@ -257,9 +257,9 @@ inline std::string escape_string(const std::string &s, unsigned options) {
257257
}
258258
} else {
259259

260-
for(auto it = s.begin(); it != s.end(); ++it) {
260+
for(char ch : s) {
261261

262-
switch(*it) {
262+
switch(ch) {
263263
case '\"': r += "\\\""; break;
264264
case '\\': r += "\\\\"; break;
265265
#if 0
@@ -271,7 +271,7 @@ inline std::string escape_string(const std::string &s, unsigned options) {
271271
case '\r': r += "\\r"; break;
272272
case '\t': r += "\\t"; break;
273273
default:
274-
r += *it;
274+
r += ch;
275275
break;
276276
}
277277
}

0 commit comments

Comments
 (0)