From 9f4f7aa149be6481a7ef8ebba4a3f4be7de1f42c Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 14 Apr 2020 18:05:59 -0400 Subject: [PATCH] rbd-mirror: utilize structured binding in 'for' loop Signed-off-by: Jason Dillaman (cherry picked from commit 847f178c4bfb50ab1c1b21222fcb47759119aa43) --- src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc index 7980f525491ce..091a40d5b2c6d 100644 --- a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc +++ b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc @@ -872,17 +872,14 @@ void Replayer::create_non_primary_snapshot() { // (re)build a full mapping from remote to local snap ids for all user // snapshots to support applying image state in the future - for (auto remote_snap_info_it = remote_image_ctx->snap_info.begin(); - remote_snap_info_it != remote_image_ctx->snap_info.end(); - ++remote_snap_info_it) { - auto remote_snap_id = remote_snap_info_it->first; + for (auto& [remote_snap_id, remote_snap_info] : + remote_image_ctx->snap_info) { if (remote_snap_id >= m_remote_snap_id_end) { break; } // we can ignore all non-user snapshots since image state only includes // user snapshots - auto& remote_snap_info = remote_snap_info_it->second; if (boost::get( &remote_snap_info.snap_namespace) == nullptr) { continue; -- 2.39.5