Skip to content

Commit 7581910

Browse files
gengjiawenZYSzys
authored andcommitted
src: fix performance-faster-string-find in node_report.cc
PR-URL: #27262 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]>
1 parent 02885da commit 7581910

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/node_report.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static void PrintJavaScriptStack(JSONWriter* writer,
340340
String::Utf8Value sv(isolate, stackstr);
341341
ss = std::string(*sv, sv.length());
342342
}
343-
int line = ss.find("\n");
343+
int line = ss.find('\n');
344344
if (line == -1) {
345345
writer->json_keyvalue("message", ss);
346346
writer->json_objectend();
@@ -349,15 +349,15 @@ static void PrintJavaScriptStack(JSONWriter* writer,
349349
writer->json_keyvalue("message", l);
350350
writer->json_arraystart("stack");
351351
ss = ss.substr(line + 1);
352-
line = ss.find("\n");
352+
line = ss.find('\n');
353353
while (line != -1) {
354354
l = ss.substr(0, line);
355355
l.erase(l.begin(), std::find_if(l.begin(), l.end(), [](int ch) {
356356
return !std::iswspace(ch);
357357
}));
358358
writer->json_element(l);
359359
ss = ss.substr(line + 1);
360-
line = ss.find("\n");
360+
line = ss.find('\n');
361361
}
362362
}
363363
writer->json_arrayend();

0 commit comments

Comments
 (0)