aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
authorGravatar Thiago Farina <tfarina@chromium.org>2016-09-28 08:59:38 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-28 09:18:26 +0000
commitaf25cea3d0b2663226a3718fdfa619457a43a8b9 (patch)
tree076ee7d060b0df06708c5cb9eeb0d0717823cbea /src/main/cpp
parent1047bbbb4a024ccc372f1464f8439764b233a1a8 (diff)
cpp: reuse InWorkspace() function in GetWorkspace()
The access() check in the do-while loop is basically doing the same thing that the InWorkspace() function provides. So lets just call that function instead. It also has the effect of making the code easier to read and understand. -- Change-Id: I02495775a9c9aa262396261824359538ca650e36 Reviewed-on: https://bazel-review.googlesource.com/#/c/6230 MOS_MIGRATED_REVID=134509465
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/workspace_layout.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main/cpp/workspace_layout.cc b/src/main/cpp/workspace_layout.cc
index 2ea04ce14d..0a44ee8843 100644
--- a/src/main/cpp/workspace_layout.cc
+++ b/src/main/cpp/workspace_layout.cc
@@ -39,8 +39,7 @@ string WorkspaceLayout::GetWorkspace(const string &cwd) {
string workspace = cwd;
do {
- if (access(blaze_util::JoinPath(
- workspace, kWorkspaceMarker).c_str(), F_OK) != -1) {
+ if (InWorkspace(workspace)) {
return workspace;
}
workspace = blaze_util::Dirname(workspace);