summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-06-04 00:47:37 -0700
committerGitHub <noreply@github.com>2020-06-04 09:47:37 +0200
commitbe6c7afcd1eb87b150a285043520d46d23674070 (patch)
treeeaf967a820dd838f729aa5a27f16b471a2fc9792
parenta32a2087b65e9e858fbd1450555108bfda95adfb (diff)
downloadninja-be6c7afcd1eb87b150a285043520d46d23674070.tar.gz
[clang-tidy] check empty instead of size (#1784)
Found with readability-container-size-empty Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--src/build.cc2
-rw-r--r--src/build_test.cc2
-rw-r--r--src/deps_log.cc2
-rw-r--r--src/string_piece_util.cc2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/build.cc b/src/build.cc
index cd8df4e..a16593b 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -1033,7 +1033,7 @@ bool Builder::FinishCommand(CommandRunner::Result* result, string* err) {
}
if (!deps_type.empty() && !config_.dry_run) {
- assert(edge->outputs_.size() >= 1 && "should have been rejected by parser");
+ assert(!edge->outputs_.empty() && "should have been rejected by parser");
for (std::vector<Node*>::const_iterator o = edge->outputs_.begin();
o != edge->outputs_.end(); ++o) {
TimeStamp deps_mtime = disk_interface_->Stat((*o)->path(), err);
diff --git a/src/build_test.cc b/src/build_test.cc
index 426e825..12c3383 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -672,7 +672,7 @@ bool FakeCommandRunner::WaitForCommand(Result* result) {
bool verify_active_edge_found = false;
for (vector<Edge*>::iterator i = active_edges_.begin();
i != active_edges_.end(); ++i) {
- if ((*i)->outputs_.size() >= 1 &&
+ if (!(*i)->outputs_.empty() &&
(*i)->outputs_[0]->path() == verify_active_edge) {
verify_active_edge_found = true;
}
diff --git a/src/deps_log.cc b/src/deps_log.cc
index cf55194..59a1956 100644
--- a/src/deps_log.cc
+++ b/src/deps_log.cc
@@ -399,7 +399,7 @@ bool DepsLog::RecordId(Node* node) {
if (fwrite(&size, 4, 1, file_) < 1)
return false;
if (fwrite(node->path().data(), path_size, 1, file_) < 1) {
- assert(node->path().size() > 0);
+ assert(!node->path().empty());
return false;
}
if (padding && fwrite("\0\0", padding, 1, file_) < 1)
diff --git a/src/string_piece_util.cc b/src/string_piece_util.cc
index 8e1ecfd..69513f5 100644
--- a/src/string_piece_util.cc
+++ b/src/string_piece_util.cc
@@ -39,7 +39,7 @@ vector<StringPiece> SplitStringPiece(StringPiece input, char sep) {
}
string JoinStringPiece(const vector<StringPiece>& list, char sep) {
- if (list.size() == 0){
+ if (list.empty()) {
return "";
}