Skip to content

Commit

Permalink
src: refactor to avoid goto in node_file.cc
Browse files Browse the repository at this point in the history
PR-URL: #32637
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
tniessen authored and targos committed Apr 11, 2020
1 parent a25ceef commit 246b789
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,8 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {

while (p < pe) {
char c = *p++;
if (c == '"') goto quote; // Keeps code flat and inner loop small.
if (c == '\\' && p < pe && *p == '"') p++;
continue;
quote:
if (c != '"') continue;
*ppos++ = p;
if (ppos < &pos[2]) continue;
ppos = &pos[0];
Expand Down

0 comments on commit 246b789

Please sign in to comment.