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 <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
tniessen authored and targos committed Apr 22, 2020
1 parent 2c5b014 commit a502209
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 @@ -825,10 +825,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 a502209

Please sign in to comment.