mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Reduce scope of for loop variables to for loop initializer (#517)
This commit is contained in:
committed by
Fred Silberberg
parent
dbe821baee
commit
a5cd24e7ea
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user