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 addaleax committed Apr 7, 2020
1 parent 1c816f0 commit f4dfbeb
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 @@ -878,10 +878,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 f4dfbeb

Please sign in to comment.