diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-02-13 17:38:56 +0100 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-02-14 19:27:38 +0100 |
commit | fc0a108773e0e4c5e9a17422825de986d2256e9a (patch) | |
tree | 9d80859da6328b0e32806ef7f105b44bc7abf28a /src/key_value_store/cls_kvs.cc | |
parent | crushtool.cc: use !empty() instead of 'size() > 0' to check for emptiness (diff) | |
download | ceph-fc0a108773e0e4c5e9a17422825de986d2256e9a.tar.xz ceph-fc0a108773e0e4c5e9a17422825de986d2256e9a.zip |
cls_kvs.cc: use !empty() instead of 'size() > 0' to check for emptiness
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().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Diffstat (limited to 'src/key_value_store/cls_kvs.cc')
-rw-r--r-- | src/key_value_store/cls_kvs.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/key_value_store/cls_kvs.cc b/src/key_value_store/cls_kvs.cc index fad46f0ca60..8c70a63f54b 100644 --- a/src/key_value_store/cls_kvs.cc +++ b/src/key_value_store/cls_kvs.cc @@ -56,7 +56,7 @@ static int get_idata_from_key(cls_method_context_t hctx, const string &key, CLS_LOG(20, "%s is already in the index: %d", key.c_str(), r); bufferlist::iterator b = raw_val.begin(); idata.decode(b); - if (kvmap.size() != 0) { + if (!kvmap.empty()) { bufferlist::iterator b = kvmap.begin()->second.begin(); next_idata.decode(b); } @@ -120,7 +120,7 @@ static int get_next_idata(cls_method_context_t hctx, const index_data &idata, return r; } - if (kvs.size() > 0) { + if (!kvs.empty()) { out_data.kdata.parse(kvs.begin()->first); bufferlist::iterator b = kvs.begin()->second.begin(); out_data.decode(b); |