From 51aa5a5364dffb7d8d278a66e69f190aef05c666 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 1 May 2021 12:36:48 -0700 Subject: fixup! hle: kernel: Add initial impl. of KAutoObjectWithListContainer. --- src/core/hle/kernel/k_auto_object_container.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp index 85d03ebe3..fc0c28874 100644 --- a/src/core/hle/kernel/k_auto_object_container.cpp +++ b/src/core/hle/kernel/k_auto_object_container.cpp @@ -21,15 +21,8 @@ void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) { size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) { KScopedLightLock lk(m_lock); - size_t count = 0; - - for (auto& obj : m_object_list) { - if (obj.GetOwner() == owner) { - count++; - } - } - - return count; + return std::count_if(m_object_list.begin(), m_object_list.end(), + [&](const auto& obj) { return obj.GetOwner() == owner; }); } } // namespace Kernel -- cgit v1.2.3