]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
Monitor.cc: use empty() instead of size()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 13:38:28 +0000 (14:38 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 13:38:28 +0000 (14:38 +0100)
commit8fcd31f6cc6f2993b981ec139307fe7d47712dbb
tree901bb30e3ba029da93c7fa3c55f4064b3ea805a2
parentf7078b4ae35ded543f9fbedd60c7559d6a5ebc3a
Monitor.cc: use empty() instead of size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppcheck was:
[src/mon/Monitor.cc:487]: (performance) Possible inefficient
  checking for 'initial_members' emptiness.
[src/mon/Monitor.cc:1361]: (performance) Possible inefficient
  checking for 'timecheck_skews' emptiness.
[src/mon/Monitor.cc:2302]: (performance) Possible inefficient
  checking for 'timecheck_waiting' emptiness.
[src/mon/Monitor.cc:2547]: (performance) Possible inefficient
  checking for 'timecheck_waiting' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mon/Monitor.cc