From: pi1024e <49824824+pi1024e@users.noreply.github.com> Date: Wed, 26 Feb 2020 00:25:19 +0000 (-0500) Subject: Convert walk while-loop to for loop, which makes most sense for a walk (#32399) X-Git-Tag: submit/tizen/20210909.063632~9499 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d29b5809e7000e649c6dfb0ce6e251f058dba7e7;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Convert walk while-loop to for loop, which makes most sense for a walk (#32399) --- diff --git a/src/coreclr/src/vm/eventstore.cpp b/src/coreclr/src/vm/eventstore.cpp index a555beb..d986e81 100644 --- a/src/coreclr/src/vm/eventstore.cpp +++ b/src/coreclr/src/vm/eventstore.cpp @@ -33,7 +33,7 @@ public: EventStoreElem *walk; EventStoreElem *next; - + walk = m_Store; while (walk) { next = walk->next; @@ -58,22 +58,18 @@ public: #ifdef _DEBUG // See if we have some leakage. LONG count = 0; - walk = m_Store; - while (walk) { + for (walk = m_Store; walk; walk = walk->next) { count += walk->AvailableEventCount(); - walk = walk->next; } // The number of events stored in the pool should be small. _ASSERTE (count <= ThreadStore::s_pThreadStore->ThreadCountInEE() * 2 + 10); #endif - walk = m_Store; - while (walk) { + for (walk = m_Store; walk; walk = walk->next) { if (walk->StoreHandleForEvent (handle) ) return; if (walk->next == NULL) { break; } - walk = walk->next; } if (walk != NULL) { @@ -139,8 +135,7 @@ private: { LIMITED_METHOD_CONTRACT; - int i; - for (i = 0; i < EventStoreLength; i++) { + for (int i = 0; i < EventStoreLength; i++) { if (hArray[i] == NULL) { hArray[i] = handle; return TRUE; @@ -154,8 +149,7 @@ private: { LIMITED_METHOD_CONTRACT; - int i; - for (i = 0; i < EventStoreLength; i++) { + for (int i = 0; i < EventStoreLength; i++) { if (hArray[i] != NULL) { CLREvent* handle = hArray[i]; hArray[i] = NULL;