summaryrefslogtreecommitdiff
path: root/Source/cmFileLockPool.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 10:34:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-16 16:05:19 -0400
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmFileLockPool.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadcmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/cmFileLockPool.cxx')
-rw-r--r--Source/cmFileLockPool.cxx103
1 files changed, 42 insertions, 61 deletions
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index 939a8f5371..7c514595c6 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -52,85 +52,73 @@ void cmFileLockPool::PopFileScope()
this->FileScopes.pop_back();
}
-cmFileLockResult cmFileLockPool::LockFunctionScope(
- const std::string& filename, unsigned long timeoutSec)
+cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename,
+ unsigned long timeoutSec)
{
- if (this->IsAlreadyLocked(filename))
- {
+ if (this->IsAlreadyLocked(filename)) {
return cmFileLockResult::MakeAlreadyLocked();
- }
- if (this->FunctionScopes.empty())
- {
+ }
+ if (this->FunctionScopes.empty()) {
return cmFileLockResult::MakeNoFunction();
- }
+ }
return this->FunctionScopes.back()->Lock(filename, timeoutSec);
}
-cmFileLockResult cmFileLockPool::LockFileScope(
- const std::string& filename, unsigned long timeoutSec)
+cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename,
+ unsigned long timeoutSec)
{
- if (this->IsAlreadyLocked(filename))
- {
+ if (this->IsAlreadyLocked(filename)) {
return cmFileLockResult::MakeAlreadyLocked();
- }
+ }
assert(!this->FileScopes.empty());
return this->FileScopes.back()->Lock(filename, timeoutSec);
}
-cmFileLockResult cmFileLockPool::LockProcessScope(
- const std::string& filename, unsigned long timeoutSec)
+cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename,
+ unsigned long timeoutSec)
{
- if (this->IsAlreadyLocked(filename))
- {
+ if (this->IsAlreadyLocked(filename)) {
return cmFileLockResult::MakeAlreadyLocked();
- }
+ }
return this->ProcessScope.Lock(filename, timeoutSec);
}
cmFileLockResult cmFileLockPool::Release(const std::string& filename)
{
- for (It i = this->FunctionScopes.begin();
- i != this->FunctionScopes.end(); ++i)
- {
+ for (It i = this->FunctionScopes.begin(); i != this->FunctionScopes.end();
+ ++i) {
const cmFileLockResult result = (*i)->Release(filename);
- if (!result.IsOk())
- {
+ if (!result.IsOk()) {
return result;
- }
}
+ }
- for (It i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i)
- {
+ for (It i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i) {
const cmFileLockResult result = (*i)->Release(filename);
- if (!result.IsOk())
- {
+ if (!result.IsOk()) {
return result;
- }
}
+ }
return this->ProcessScope.Release(filename);
}
bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const
{
- for (CIt i = this->FunctionScopes.begin();
- i != this->FunctionScopes.end(); ++i)
- {
+ for (CIt i = this->FunctionScopes.begin(); i != this->FunctionScopes.end();
+ ++i) {
const bool result = (*i)->IsAlreadyLocked(filename);
- if (result)
- {
+ if (result) {
return true;
- }
}
+ }
- for (CIt i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i)
- {
+ for (CIt i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i) {
const bool result = (*i)->IsAlreadyLocked(filename);
- if (result)
- {
+ if (result) {
return true;
- }
}
+ }
return this->ProcessScope.IsAlreadyLocked(filename);
}
@@ -144,45 +132,38 @@ cmFileLockPool::ScopePool::~ScopePool()
cmDeleteAll(this->Locks);
}
-cmFileLockResult cmFileLockPool::ScopePool::Lock(
- const std::string& filename, unsigned long timeoutSec)
+cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename,
+ unsigned long timeoutSec)
{
- cmFileLock *lock = new cmFileLock();
+ cmFileLock* lock = new cmFileLock();
const cmFileLockResult result = lock->Lock(filename, timeoutSec);
- if (result.IsOk())
- {
+ if (result.IsOk()) {
this->Locks.push_back(lock);
return cmFileLockResult::MakeOk();
- }
- else
- {
+ } else {
delete lock;
return result;
- }
+ }
}
cmFileLockResult cmFileLockPool::ScopePool::Release(
- const std::string& filename)
+ const std::string& filename)
{
- for (It i = this->Locks.begin(); i != this->Locks.end(); ++i)
- {
- if ((*i)->IsLocked(filename))
- {
+ for (It i = this->Locks.begin(); i != this->Locks.end(); ++i) {
+ if ((*i)->IsLocked(filename)) {
return (*i)->Release();
- }
}
+ }
return cmFileLockResult::MakeOk();
}
bool cmFileLockPool::ScopePool::IsAlreadyLocked(
- const std::string& filename) const
+ const std::string& filename) const
{
- for (CIt i = this->Locks.begin(); i != this->Locks.end(); ++i)
- {
- if ((*i)->IsLocked(filename))
- {
+ for (CIt i = this->Locks.begin(); i != this->Locks.end(); ++i) {
+ if ((*i)->IsLocked(filename)) {
return true;
- }
}
+ }
return false;
}