Reduce scope of for loop variables to for loop initializer (#517)

This commit is contained in:
Chris Gregory
2017-05-06 23:15:34 -07:00
committed by Fred Silberberg
parent dbe821baee
commit a5cd24e7ea
8 changed files with 42 additions and 51 deletions

View File

@@ -58,8 +58,7 @@ LimitedClassedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
std::shared_ptr<TStruct> toSet) {
// globally lock to loop through indices
std::lock_guard<priority_mutex> sync(m_allocateMutex);
int16_t i;
for (i = 0; i < size; i++) {
for (int16_t i = 0; i < size; i++) {
if (m_structures[i] == nullptr) {
// if a false index is found, grab its specific mutex
// and allocate it.

View File

@@ -54,8 +54,7 @@ template <typename THandle, typename TStruct, int16_t size,
THandle LimitedHandleResource<THandle, TStruct, size, enumValue>::Allocate() {
// globally lock to loop through indices
std::lock_guard<priority_mutex> sync(m_allocateMutex);
int16_t i;
for (i = 0; i < size; i++) {
for (int16_t i = 0; i < size; i++) {
if (m_structures[i] == nullptr) {
// if a false index is found, grab its specific mutex
// and allocate it.