From d06d4031365602b1f41ed87dba361503a816ea32 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 28 Apr 2019 16:48:31 +0200 Subject: [PATCH] Replace 'while' loop with 'for' loop for simple iterations Using 'for' loop to do a simple iteration is more intuitive and makes the code simpler. --- src/propgrid/property.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 812ab80ac9..b55b97b70a 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -2548,7 +2548,6 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const // // iMax is used when finding property y-positions. // - unsigned int i = 0; int h = 0; if ( iMax_ == -1 ) @@ -2561,7 +2560,7 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const if ( !IsExpanded() && GetParent() ) return 0; - while ( i < iMax ) + for ( unsigned int i = 0; i < iMax; i++ ) { wxPGProperty* pwc = (wxPGProperty*) Item(i); @@ -2573,8 +2572,6 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const else h += pwc->GetChildrenHeight(lh) + lh; } - - i++; } return h; @@ -2592,10 +2589,8 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y, wxPGProperty* result = NULL; wxPGProperty* current = NULL; unsigned int iy = *nextItemY; - unsigned int i = 0; - unsigned int iMax = GetChildCount(); - while ( i < iMax ) + for ( unsigned int i = 0; i < GetChildCount(); i++ ) { wxPGProperty* pwc = Item(i); @@ -2620,8 +2615,6 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y, current = pwc; } - - i++; } // Found?