diff options
author | kobewi <kobewi4e@gmail.com> | 2022-12-29 01:24:45 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-01-21 18:44:42 +0100 |
commit | 615c5170345b2b549be6271d11319a10a5ce34bf (patch) | |
tree | e8a8011f1c5a166636a9f68b65e108ad7bc878a0 /core/object | |
parent | 277d5361df22c4aa18e93354190b7694dfdf6249 (diff) |
Use range iterators in LocalVector loops
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/undo_redo.cpp | 3 | ||||
-rw-r--r-- | core/object/worker_thread_pool.cpp | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp index e84933eb69..077929351e 100644 --- a/core/object/undo_redo.cpp +++ b/core/object/undo_redo.cpp @@ -99,8 +99,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) { } } - for (unsigned int i = 0; i < to_remove.size(); i++) { - List<Operation>::Element *E = to_remove[i]; + for (List<Operation>::Element *E : to_remove) { // Delete all object references E->get().delete_reference(); E->erase(); diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp index fc907b2301..721c8d0a10 100644 --- a/core/object/worker_thread_pool.cpp +++ b/core/object/worker_thread_pool.cpp @@ -377,11 +377,11 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) { Group *group = *groupp; if (group->low_priority_native_tasks.size() > 0) { - for (uint32_t i = 0; i < group->low_priority_native_tasks.size(); i++) { - group->low_priority_native_tasks[i]->low_priority_thread->wait_to_finish(); - native_thread_allocator.free(group->low_priority_native_tasks[i]->low_priority_thread); + for (Task *task : group->low_priority_native_tasks) { + task->low_priority_thread->wait_to_finish(); + native_thread_allocator.free(task->low_priority_thread); task_mutex.lock(); - task_allocator.free(group->low_priority_native_tasks[i]); + task_allocator.free(task); task_mutex.unlock(); } @@ -449,8 +449,8 @@ void WorkerThreadPool::finish() { task_available_semaphore.post(); } - for (uint32_t i = 0; i < threads.size(); i++) { - threads[i].thread.wait_to_finish(); + for (ThreadData &data : threads) { + data.thread.wait_to_finish(); } threads.clear(); |