Skip to content

Commit 4d502e7

Browse files
committed
Name last_hex_digit variable in JSON parser
A named variable is clearer that referring to the value twice in relation to p, where p changes in between.
1 parent 0a3ddf8 commit 4d502e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/json/parser.y

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ static std::string convert_TOK_STRING()
5151
{
5252
// Character in hexadecimal Unicode representation, in the format
5353
// \uABCD, i.e. the following four digits are part of this character.
54-
assert(p + 4 < yyjsontext + len - 1);
54+
char *last_hex_digit = p + 4;
55+
assert(last_hex_digit < yyjsontext + len - 1);
5556
std::string hex(++p, 4);
5657
result += codepoint_hex_to_utf8(hex);
57-
p += 3;
58+
p = last_hex_digit;
5859
break;
5960
}
6061
default:; /* an error */

0 commit comments

Comments
 (0)