Skip to content

Commit

Permalink
test/ObjectMap/KeyValueDBMemory.cc: use empty() instead of size()
Browse files Browse the repository at this point in the history
Use empty() instead of 'size() == 0' to fix:

[src/test/ObjectMap/KeyValueDBMemory.cc:83]: (performance)
 Possible inefficient checking for 'db' emptiness.
[src/test/ObjectMap/KeyValueDBMemory.cc:97]: (performance)
 Possible inefficient checking for 'db' emptiness.

Signed-off-by: Danny Al-Gaaf <[email protected]>
  • Loading branch information
dalgaaf committed May 11, 2014
1 parent b24b77a commit 014f050
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/ObjectMap/KeyValueDBMemory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class WholeSpaceMemIterator : public KeyValueDB::WholeSpaceIteratorImpl {

int lower_bound(const string &prefix, const string &to) {
it = db->db.lower_bound(make_pair(prefix,to));
if ((db->db.size() == 0) || (it == db->db.end())) {
if ((db->db.empty()) || (it == db->db.end())) {
it = db->db.end();
ready = false;
return 0;
Expand All @@ -94,7 +94,7 @@ class WholeSpaceMemIterator : public KeyValueDB::WholeSpaceIteratorImpl {

int upper_bound(const string &prefix, const string &after) {
it = db->db.upper_bound(make_pair(prefix,after));
if ((db->db.size() == 0) || (it == db->db.end())) {
if ((db->db.empty()) || (it == db->db.end())) {
it = db->db.end();
ready = false;
return 0;
Expand Down

0 comments on commit 014f050

Please sign in to comment.