]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/crush/CrushTester.{cc,h}: prefer prefix ++operator for iterators
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Mar 2013 17:40:44 +0000 (18:40 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Mar 2013 17:40:44 +0000 (18:40 +0100)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/crush/CrushTester.cc
src/crush/CrushTester.h

index a659787e4f1ba60549823878c85047a3c521943d..0a649d8c77c0ccc2eed3854c9b3a1dcbe8c53ac3 100644 (file)
@@ -44,7 +44,7 @@ int CrushTester::get_maximum_affected_by_rule(int ruleno)
   // loop through the vector of affected types
   for (vector<int>::iterator it = affected_types.begin(); it != affected_types.end(); ++it){
     // loop through the number of buckets looking for affected types
-    for (map<int,string>::iterator p = crush.name_map.begin(); p != crush.name_map.end(); p++){
+    for (map<int,string>::iterator p = crush.name_map.begin(); p != crush.name_map.end(); ++p){
       int bucket_type = crush.get_bucket_type(p->first);
       if ( bucket_type == *it)
         max_devices_of_type[*it]++;
@@ -152,7 +152,7 @@ bool CrushTester::check_valid_placement(int ruleno, vector<int> in, const vector
   map<string,string> seen_devices;
 
   // first do the easy check that all devices are "up"
-  for (vector<int>::iterator it = in.begin(); it != in.end(); it++) {
+  for (vector<int>::iterator it = in.begin(); it != in.end(); ++it) {
     if (weight[(*it)] == 0) {
       valid_placement = false;
       break;
@@ -173,7 +173,7 @@ bool CrushTester::check_valid_placement(int ruleno, vector<int> in, const vector
 
   // get the smallest type id, and name
   int min_map_type = crush.get_num_type_names();
-  for (map<int,string>::iterator it = crush.type_map.begin(); it != crush.type_map.end(); it++ ) {
+  for (map<int,string>::iterator it = crush.type_map.begin(); it != crush.type_map.end(); ++it ) {
     if ( (*it).first < min_map_type ) {
       min_map_type = (*it).first;
     }
@@ -202,7 +202,7 @@ bool CrushTester::check_valid_placement(int ruleno, vector<int> in, const vector
   }
 
   // check that we don't have any duplicate id's
-  for (vector<int>::iterator it = included_devices.begin(); it != included_devices.end(); it++) {
+  for (vector<int>::iterator it = included_devices.begin(); it != included_devices.end(); ++it) {
     int num_copies = count(included_devices.begin(), included_devices.end(), (*it) );
     if (num_copies > 1) {
       valid_placement = false;
@@ -212,7 +212,7 @@ bool CrushTester::check_valid_placement(int ruleno, vector<int> in, const vector
   // if we have more than just osd's affected we need to do a lot more work
   if (!only_osd_affected) {
     // loop through the devices that are "in/up"
-    for (vector<int>::iterator it = included_devices.begin(); it != included_devices.end(); it++) {
+    for (vector<int>::iterator it = included_devices.begin(); it != included_devices.end(); ++it) {
       if (valid_placement == false)
         break;
 
@@ -220,7 +220,7 @@ bool CrushTester::check_valid_placement(int ruleno, vector<int> in, const vector
       map<string,string> device_location_hierarchy = crush.get_full_location(*it);
 
       // loop over the types affected by RULENO looking for duplicate bucket assignments
-      for (vector<string>::iterator t = affected_types.begin(); t != affected_types.end(); t++) {
+      for (vector<string>::iterator t = affected_types.begin(); t != affected_types.end(); ++t) {
         if (seen_devices.count( device_location_hierarchy[*t])) {
           valid_placement = false;
           break;
@@ -523,7 +523,7 @@ int CrushTester::test()
           err << "  device " << i
           << ":\t" << per[i] << std::endl;
 
-      for (map<int,int>::iterator p = sizes.begin(); p != sizes.end(); p++)
+      for (map<int,int>::iterator p = sizes.begin(); p != sizes.end(); ++p)
         if (output_statistics)
           err << "rule " << r << " (" << crush.get_rule_name(r) << ") num_rep " << nr
           << " result size == " << p->first << ":\t"
index 4a23fd614e23319f3738534b08f180390fc24a13..0cbab0fd988064d168af1d5d16392a3514cb5bac 100644 (file)
@@ -89,14 +89,14 @@ class CrushTester {
    void write_to_csv(ofstream& csv_file, vector<string>& payload)
    {
      if (csv_file.good())
-       for (vector<string>::iterator it = payload.begin(); it != payload.end(); it++)
+       for (vector<string>::iterator it = payload.begin(); it != payload.end(); ++it)
          csv_file << (*it);
    }
 
    void write_to_csv(ofstream& csv_file, map<int, float>& payload)
    {
      if (csv_file.good())
-       for (map<int, float>::iterator it = payload.begin(); it != payload.end(); it++)
+       for (map<int, float>::iterator it = payload.begin(); it != payload.end(); ++it)
          csv_file << (*it).first << ',' << (*it).second << std::endl;
    }