[Lint] Added InsertBraces to linter to unify codebase to one standard
This commit is contained in:
@@ -417,7 +417,9 @@ class PosixCondition<Semaphore> final : public PosixConditionBase {
|
||||
if (count_ + release_count > maximum_count_) {
|
||||
return false;
|
||||
}
|
||||
if (out_previous_count) *out_previous_count = count_;
|
||||
if (out_previous_count) {
|
||||
*out_previous_count = count_;
|
||||
}
|
||||
count_ += release_count;
|
||||
cond_.notify_all();
|
||||
return true;
|
||||
@@ -583,7 +585,9 @@ class PosixCondition<Thread> final : public PosixConditionBase {
|
||||
ThreadStartData* start_data) {
|
||||
start_data->create_suspended = params.create_suspended;
|
||||
pthread_attr_t attr;
|
||||
if (pthread_attr_init(&attr) != 0) return false;
|
||||
if (pthread_attr_init(&attr) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (pthread_attr_setstacksize(&attr, params.stack_size) != 0) {
|
||||
pthread_attr_destroy(&attr);
|
||||
return false;
|
||||
@@ -782,8 +786,12 @@ class PosixCondition<Thread> final : public PosixConditionBase {
|
||||
// Center: fifo 16 → nice 0.
|
||||
int nice_val = 16 - new_priority;
|
||||
// Clamp to valid nice range.
|
||||
if (nice_val < -20) nice_val = -20;
|
||||
if (nice_val > 19) nice_val = 19;
|
||||
if (nice_val < -20) {
|
||||
nice_val = -20;
|
||||
}
|
||||
if (nice_val > 19) {
|
||||
nice_val = 19;
|
||||
}
|
||||
if (tid_ > 0) {
|
||||
setpriority(PRIO_PROCESS, tid_, nice_val);
|
||||
}
|
||||
@@ -1027,9 +1035,13 @@ WaitResult Wait(WaitHandle* wait_handle, bool is_alertable,
|
||||
if (posix_wait_handle == nullptr) {
|
||||
return WaitResult::kFailed;
|
||||
}
|
||||
if (is_alertable) alertable_state_ = true;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = true;
|
||||
}
|
||||
auto result = posix_wait_handle->condition().Wait(timeout);
|
||||
if (is_alertable) alertable_state_ = false;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1045,11 +1057,15 @@ WaitResult SignalAndWait(WaitHandle* wait_handle_to_signal,
|
||||
posix_wait_handle_to_wait_on == nullptr) {
|
||||
return WaitResult::kFailed;
|
||||
}
|
||||
if (is_alertable) alertable_state_ = true;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = true;
|
||||
}
|
||||
if (posix_wait_handle_to_signal->condition().Signal()) {
|
||||
result = posix_wait_handle_to_wait_on->condition().Wait(timeout);
|
||||
}
|
||||
if (is_alertable) alertable_state_ = false;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1066,10 +1082,14 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
|
||||
}
|
||||
conditions.push_back(&handle->condition());
|
||||
}
|
||||
if (is_alertable) alertable_state_ = true;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = true;
|
||||
}
|
||||
auto result = PosixConditionBase::WaitMultiple(std::move(conditions),
|
||||
wait_all, timeout);
|
||||
if (is_alertable) alertable_state_ = false;
|
||||
if (is_alertable) {
|
||||
alertable_state_ = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1305,7 +1325,9 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
|
||||
install_signal_handler(SignalType::kThreadTerminate);
|
||||
#endif
|
||||
auto thread = std::make_unique<PosixThread>();
|
||||
if (!thread->Initialize(params, std::move(start_routine))) return nullptr;
|
||||
if (!thread->Initialize(params, std::move(start_routine))) {
|
||||
return nullptr;
|
||||
}
|
||||
assert_not_null(thread);
|
||||
return thread;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user