Skip to content

Commit

Permalink
util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types
Browse files Browse the repository at this point in the history
Prefer prefix ++operator for non-primitive types like iterators for
performance reasons. Prefix ++/-- operators avoid creating a temporary
copy.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
  • Loading branch information
dalgaaf committed Sep 30, 2014
1 parent af8c2b2 commit 4cc8643
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/ldb_cmd.cc
Expand Up @@ -325,7 +325,7 @@ bool LDBCommand::ParseKeyValue(const string& line, string* key, string* value,
bool LDBCommand::ValidateCmdLineOptions() {

for (map<string, string>::const_iterator itr = option_map_.begin();
itr != option_map_.end(); itr++) {
itr != option_map_.end(); ++itr) {
if (find(valid_cmd_line_options_.begin(),
valid_cmd_line_options_.end(), itr->first) ==
valid_cmd_line_options_.end()) {
Expand All @@ -335,7 +335,7 @@ bool LDBCommand::ValidateCmdLineOptions() {
}

for (vector<string>::const_iterator itr = flags_.begin();
itr != flags_.end(); itr++) {
itr != flags_.end(); ++itr) {
if (find(valid_cmd_line_options_.begin(),
valid_cmd_line_options_.end(), *itr) ==
valid_cmd_line_options_.end()) {
Expand Down Expand Up @@ -1538,7 +1538,7 @@ void BatchPutCommand::DoCommand() {
WriteBatch batch;

for (vector<pair<string, string>>::const_iterator itr
= key_values_.begin(); itr != key_values_.end(); itr++) {
= key_values_.begin(); itr != key_values_.end(); ++itr) {
batch.Put(itr->first, itr->second);
}
Status st = db_->Write(WriteOptions(), &batch);
Expand Down

0 comments on commit 4cc8643

Please sign in to comment.