Skip to content

Commit 6ec238b

Browse files
authored
[NFC] Replace C macro with C++ lambda in json.h (#8082)
1 parent 73c3a05 commit 6ec238b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/support/json.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,15 @@ struct Value {
271271
};
272272

273273
char* parse(char* curr, StringEncoding stringEncoding) {
274-
#define is_json_space(x) \
275-
(x == 32 || x == 9 || x == 10 || \
276-
x == 13) /* space, tab, linefeed/newline, or return */
277-
#define skip() \
278-
{ \
279-
while (*curr && is_json_space(*curr)) \
280-
curr++; \
281-
}
274+
auto is_json_space = [](char x) -> bool {
275+
return x == 32 || x == 9 || x == 10 ||
276+
x == 13; /* space, tab, linefeed/newline, or return */
277+
};
278+
auto skip = [&]() -> void {
279+
while (*curr && is_json_space(*curr)) {
280+
curr++;
281+
}
282+
};
282283
skip();
283284
if (*curr == '"') {
284285
// String

0 commit comments

Comments
 (0)