]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
PeeringState: modernize accept_buffered_messages
authorSamuel Just <sjust@redhat.com>
Thu, 30 May 2019 02:02:51 +0000 (19:02 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 30 May 2019 17:53:42 +0000 (10:53 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PeeringState.h

index d4e3ede42c357367386adbadaedff307cc4e5639..251a1e7352654b64e70fa73ccd3c0d7da506e994 100644 (file)
@@ -75,33 +75,21 @@ struct PeeringCtx {
   }
 
   void accept_buffered_messages(BufferedRecoveryMessages &m) {
-    for (map<int, map<spg_t, pg_query_t> >::iterator i = m.query_map.begin();
-        i != m.query_map.end();
-        ++i) {
-      map<spg_t, pg_query_t> &omap = query_map[i->first];
-      for (map<spg_t, pg_query_t>::iterator j = i->second.begin();
-          j != i->second.end();
-          ++j) {
-       omap[j->first] = j->second;
+    for (auto &[target, qmap] : m.query_map) {
+      auto &omap = query_map[target];
+      for (auto &[pg, query] : qmap) {
+       omap[pg] = query;
       }
     }
-    for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
-          = m.info_map.begin();
-        i != m.info_map.end();
-        ++i) {
-      vector<pair<pg_notify_t, PastIntervals> > &ovec =
-       info_map[i->first];
-      ovec.reserve(ovec.size() + i->second.size());
-      ovec.insert(ovec.end(), i->second.begin(), i->second.end());
+    for (auto &[target, ivec] : m.info_map) {
+      auto &ovec = info_map[target];
+      ovec.reserve(ovec.size() + ivec.size());
+      ovec.insert(ovec.end(), ivec.begin(), ivec.end());
     }
-    for (map<int, vector<pair<pg_notify_t, PastIntervals> > >::iterator i
-          = m.notify_list.begin();
-        i != m.notify_list.end();
-        ++i) {
-      vector<pair<pg_notify_t, PastIntervals> > &ovec =
-       notify_list[i->first];
-      ovec.reserve(ovec.size() + i->second.size());
-      ovec.insert(ovec.end(), i->second.begin(), i->second.end());
+    for (auto &[target, nlist] : m.notify_list) {
+      auto &ovec = notify_list[target];
+      ovec.reserve(ovec.size() + nlist.size());
+      ovec.insert(ovec.end(), nlist.begin(), nlist.end());
     }
   }
 };