diff options
author | Tobias Nießen <tniessen@tnie.de> | 2020-07-20 00:14:56 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-08-11 23:22:04 +0300 |
commit | 1be7bbdc3b533759072cfc3d13766511197e3d01 (patch) | |
tree | 1428a01ca9e82cc939fc64e687ce51c4751aa044 /src/node_url.cc | |
parent | f280d2c85cf5bcf2cbe277de5a1f410a68c7a562 (diff) |
src: prefer C++ empty() in boolean expressions
PR-URL: https://github.com/nodejs/node/pull/34432
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r-- | src/node_url.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/node_url.cc b/src/node_url.cc index efab1060f88..bd4932c0ab0 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1170,7 +1170,7 @@ bool ParseHost(const std::string& input, std::string* output, bool is_special, bool unicode = false) { - if (input.length() == 0) { + if (input.empty()) { output->clear(); return true; } @@ -2037,7 +2037,7 @@ void URL::Parse(const char* input, (ch == kEOL || ch == '?' || ch == '#')) { - while (url->path.size() > 1 && url->path[0].length() == 0) { + while (url->path.size() > 1 && url->path[0].empty()) { url->path.erase(url->path.begin()); } } @@ -2060,9 +2060,9 @@ void URL::Parse(const char* input, state = kFragment; break; default: - if (url->path.size() == 0) + if (url->path.empty()) url->path.emplace_back(""); - if (url->path.size() > 0 && ch != kEOL) + else if (ch != kEOL) AppendOrEscape(&url->path[0], ch, C0_CONTROL_ENCODE_SET); } break; |