]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common/cmdparse: use map::find() only a single time
authorKefu Chai <kchai@redhat.com>
Thu, 20 May 2021 02:27:37 +0000 (10:27 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 22 May 2021 00:48:52 +0000 (08:48 +0800)
commit2505490e79399dc556b2244e05be9093908ee98d
tree4a69bef04c612e9dd27035f6168812a8b3318d22
parentda58cfbeffe104683933ebdc0e0221412d618384
common/cmdparse: use map::find() only a single time

instead of using the combo of

if (map.count(key)) {
  return map.find(key)->second;
}

just use

found = map.find(key);
if (found != map.end()) {
  return found->second;
}

to avoid repeating the lookup in the map with the same key.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/cmdparse.cc
src/common/cmdparse.h