From 6ce1ff43bc98c811c2abfde1a912df50faf70f5b Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Thu, 19 Mar 2020 13:19:38 -0400 Subject: [PATCH] Cleanup up repeated calls to endInstances --- indra/llcommon/lleventtimer.cpp | 8 +++----- indra/llrender/llgl.cpp | 4 ++-- indra/llui/llconsole.cpp | 2 +- indra/llui/lllayoutstack.cpp | 2 +- indra/newview/lltoast.cpp | 5 +++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/indra/llcommon/lleventtimer.cpp b/indra/llcommon/lleventtimer.cpp index 0d96e03da41..f3fe4884331 100644 --- a/indra/llcommon/lleventtimer.cpp +++ b/indra/llcommon/lleventtimer.cpp @@ -58,7 +58,7 @@ LLEventTimer::~LLEventTimer() void LLEventTimer::updateClass() { std::list<LLEventTimer*> completed_timers; - for (instance_iter iter = beginInstances(); iter != endInstances(); ) + for (instance_iter iter = beginInstances(), end = endInstances(); iter != end; ) { LLEventTimer& timer = *iter++; F32 et = timer.mEventTimer.getElapsedTimeF32(); @@ -73,11 +73,9 @@ void LLEventTimer::updateClass() if ( completed_timers.size() > 0 ) { - for (std::list<LLEventTimer*>::iterator completed_iter = completed_timers.begin(); - completed_iter != completed_timers.end(); - completed_iter++ ) + for (LLEventTimer* completed_timer : completed_timers) { - delete *completed_iter; + delete completed_timer; } } } diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index c01c15391de..474c1395f68 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2390,7 +2390,7 @@ void LLGLNamePool::release(GLuint name) //static void LLGLNamePool::upkeepPools() { - for (tracker_t::instance_iter iter = beginInstances(); iter != endInstances(); ++iter) + for (tracker_t::instance_iter iter = beginInstances(), end = endInstances(); iter != end; ++iter) { LLGLNamePool & pool = *iter; pool.upkeep(); @@ -2400,7 +2400,7 @@ void LLGLNamePool::upkeepPools() //static void LLGLNamePool::cleanupPools() { - for (tracker_t::instance_iter iter = beginInstances(); iter != endInstances(); ++iter) + for (tracker_t::instance_iter iter = beginInstances(), end = endInstances(); iter != end; ++iter) { LLGLNamePool & pool = *iter; pool.cleanup(); diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index d4d1ad3259f..446e3d73444 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -371,7 +371,7 @@ LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_t // static void LLConsole::updateClass() { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end = endInstances(); it != it_end; ++it) { it->update(); } diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4a464b3507c..654bcab773f 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -636,7 +636,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) //static void LLLayoutStack::updateClass() { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), end = endInstances(); it != end; ++it) { it->updateLayout(); it->mAnimatedThisFrame = false; diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 870e0d94f0c..c9ce72268f1 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -612,8 +612,9 @@ S32 LLToast::notifyParent(const LLSD& info) //static void LLToast::updateClass() { - for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances(); - iter != LLInstanceTracker<LLToast>::endInstances(); ) + for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances(), + end = LLInstanceTracker<LLToast>::endInstances(); + iter != end; ) { LLToast& toast = *iter++; -- GitLab