From: Nathan Binkert Date: Sat, 6 Jun 2009 00:01:19 +0000 (-0700) Subject: cleanup: Make use of types properly and make the loop a little more clear. X-Git-Tag: Calvin_Submission~287 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=baa0d695b20875ed65a52de475708bab2ee7aeaf;p=gem5.git cleanup: Make use of types properly and make the loop a little more clear. --- diff --git a/src/base/range_ops.hh b/src/base/range_ops.hh index f2b11b649..26fadacde 100644 --- a/src/base/range_ops.hh +++ b/src/base/range_ops.hh @@ -30,6 +30,7 @@ #ifndef __BASE_RANGE_OPS_HH__ #define __BASE_RANGE_OPS_HH__ + #include #include @@ -37,16 +38,19 @@ template inline void -FilterRangeList(std::vector > filter_list, std::list > - &range_list) { - typename std::list >::iterator i; - for (int x = 0; x < filter_list.size(); x++) { - for (i = range_list.begin(); i != range_list.end(); ) { +FilterRangeList(std::vector > filter_list, + std::list > &range_list) +{ + typedef typename std::list > RangeList; + + for (typename RangeList::size_type x = 0; x < filter_list.size(); x++) { + typename RangeList::iterator i = range_list.begin(); + while (i != range_list.end()) { // Is the range within one of our filter ranges? if (filter_list[x] == i->start || filter_list[x] == i->end) - range_list.erase(i++); + i = range_list.erase(i); else - i++; + ++i; } } }