diff options
author | gengjiawen <technicalcute@gmail.com> | 2019-04-16 17:36:53 +0300 |
---|---|---|
committer | ZYSzys <zyszys98@gmail.com> | 2019-04-19 06:10:55 +0300 |
commit | 758191033f8a50d54ebc21ff8fe640666ecd3236 (patch) | |
tree | f98b54474384ee63045d2c8122da857f6948231b /src/node_report.cc | |
parent | 02885dad5a7d20318fd061fdfcc593b0fe13459e (diff) |
src: fix performance-faster-string-find in node_report.cc
PR-URL: https://github.com/nodejs/node/pull/27262
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/node_report.cc')
-rw-r--r-- | src/node_report.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_report.cc b/src/node_report.cc index 4d5d770b5c3..74391cd4c1b 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -340,7 +340,7 @@ static void PrintJavaScriptStack(JSONWriter* writer, String::Utf8Value sv(isolate, stackstr); ss = std::string(*sv, sv.length()); } - int line = ss.find("\n"); + int line = ss.find('\n'); if (line == -1) { writer->json_keyvalue("message", ss); writer->json_objectend(); @@ -349,7 +349,7 @@ static void PrintJavaScriptStack(JSONWriter* writer, writer->json_keyvalue("message", l); writer->json_arraystart("stack"); ss = ss.substr(line + 1); - line = ss.find("\n"); + line = ss.find('\n'); while (line != -1) { l = ss.substr(0, line); l.erase(l.begin(), std::find_if(l.begin(), l.end(), [](int ch) { @@ -357,7 +357,7 @@ static void PrintJavaScriptStack(JSONWriter* writer, })); writer->json_element(l); ss = ss.substr(line + 1); - line = ss.find("\n"); + line = ss.find('\n'); } } writer->json_arrayend(); |