Skip to content

Commit 6e70271

Browse files
committed
Simplify codes.
1 parent 432875f commit 6e70271

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

json_parser.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,10 @@ static int __parse_json_number(const char *cursor, const char **end,
367367
break;
368368
}
369369

370-
if (digit <= 9)
370+
while (isdigit(*cursor))
371371
{
372-
do
373-
{
374-
exp++;
375-
cursor++;
376-
} while (isdigit(*cursor));
372+
exp++;
373+
cursor++;
377374
}
378375
}
379376
else if (mant == 0)
@@ -413,12 +410,8 @@ static int __parse_json_number(const char *cursor, const char **end,
413410
break;
414411
}
415412

416-
if (digit <= 9)
417-
{
418-
do
419-
cursor++;
420-
while (isdigit(*cursor));
421-
}
413+
while (isdigit(*cursor))
414+
cursor++;
422415
}
423416

424417
if (cursor - integer > 1000000)
@@ -451,12 +444,8 @@ static int __parse_json_number(const char *cursor, const char **end,
451444
break;
452445
}
453446

454-
if (digit <= 9)
455-
{
456-
do
457-
cursor++;
458-
while (isdigit(*cursor));
459-
}
447+
while (isdigit(*cursor))
448+
cursor++;
460449

461450
if (neg)
462451
e = -e;

0 commit comments

Comments
 (0)