diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-15 12:33:12 +0100 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-18 12:35:38 +0100 |
commit | 5b8a5059068b8b783769d1306f529921b4c29956 (patch) | |
tree | 1d4585970a60d6aa10652127266f4aef8776a360 | |
parent | 006a70db3bee0ac22b88893e2bf8bb724f8f75a1 (diff) | |
download | ceph-5b8a5059068b8b783769d1306f529921b4c29956.tar.gz |
rados.cc: prefer prefix ++operator for iterators
Prefer prefix ++operator for iterators, move some iterator declaration into
the for-loop header, since the iterator is only used within the loop.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
-rw-r--r-- | src/rados.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/rados.cc b/src/rados.cc index 51f998c1894..6856491014b 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -742,8 +742,7 @@ int LoadGen::run() cout << "waiting for all operations to complete" << std::endl; // now wait on all the pending requests - vector<librados::AioCompletion *>::iterator citer; - for (citer = completions.begin(); citer != completions.end(); citer++) { + for (vector<librados::AioCompletion *>::iterator citer = completions.begin(); citer != completions.end(); ++citer) { librados::AioCompletion *c = *citer; c->wait_for_complete(); c->release(); @@ -1733,7 +1732,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, header.hexdump(cout); cout << "\n"; cout << kv.size() << " keys\n"; - for (map<string,bufferlist>::iterator q = kv.begin(); q != kv.end(); q++) { + for (map<string,bufferlist>::iterator q = kv.begin(); q != kv.end(); ++q) { cout << "key '" << q->first << "' (" << q->second.length() << " bytes):\n"; q->second.hexdump(cout); cout << "\n"; @@ -1823,7 +1822,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, io_ctx.snap_list(&snaps); for (vector<snap_t>::iterator i = snaps.begin(); i != snaps.end(); - i++) { + ++i) { string s; time_t t; if (io_ctx.snap_get_name(*i, &s) < 0) @@ -2018,8 +2017,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, else ret = 0; - std::list<obj_watch_t>::iterator i; - for (i = lw.begin(); i != lw.end(); i++) { + for (std::list<obj_watch_t>::iterator i = lw.begin(); i != lw.end(); ++i) { cout << "watcher=client." << i->watcher_id << " cookie=" << i->cookie << std::endl; } } else if (strcmp(nargs[0], "listsnaps") == 0) { @@ -2042,7 +2040,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, vector<snap_t> snaps; io_ctx.snap_list(&snaps); for (vector<snap_t>::iterator i = snaps.begin(); - i != snaps.end(); i++) { + i != snaps.end(); ++i) { string s; if (io_ctx.snap_get_name(*i, &s) < 0) continue; @@ -2060,7 +2058,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, } for (std::vector<clone_info_t>::iterator ci = ls.clones.begin(); - ci != ls.clones.end(); ci++) { + ci != ls.clones.end(); ++ci) { if (formatter) formatter->open_object_section("clone"); @@ -2120,7 +2118,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, cout << "\t["; for (std::vector< std::pair<uint64_t,uint64_t> >::iterator ovi = ci->overlap.begin(); - ovi != ci->overlap.end(); ovi++) { + ovi != ci->overlap.end(); ++ovi) { if (formatter) { formatter->open_object_section("section"); formatter->dump_unsigned("start", ovi->first); @@ -2244,7 +2242,7 @@ int main(int argc, const char **argv) } else { if (val[0] == '-') usage_exit(); - i++; + ++i; } } |