util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types

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>
This commit is contained in:
Danny Al-Gaaf 2014-09-29 23:05:12 +02:00
parent af8c2b2d97
commit 4cc8643baf

View File

@ -325,7 +325,7 @@ bool LDBCommand::ParseKeyValue(const string& line, string* key, string* value,
bool LDBCommand::ValidateCmdLineOptions() { bool LDBCommand::ValidateCmdLineOptions() {
for (map<string, string>::const_iterator itr = option_map_.begin(); 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(), if (find(valid_cmd_line_options_.begin(),
valid_cmd_line_options_.end(), itr->first) == valid_cmd_line_options_.end(), itr->first) ==
valid_cmd_line_options_.end()) { valid_cmd_line_options_.end()) {
@ -335,7 +335,7 @@ bool LDBCommand::ValidateCmdLineOptions() {
} }
for (vector<string>::const_iterator itr = flags_.begin(); for (vector<string>::const_iterator itr = flags_.begin();
itr != flags_.end(); itr++) { itr != flags_.end(); ++itr) {
if (find(valid_cmd_line_options_.begin(), if (find(valid_cmd_line_options_.begin(),
valid_cmd_line_options_.end(), *itr) == valid_cmd_line_options_.end(), *itr) ==
valid_cmd_line_options_.end()) { valid_cmd_line_options_.end()) {
@ -1538,7 +1538,7 @@ void BatchPutCommand::DoCommand() {
WriteBatch batch; WriteBatch batch;
for (vector<pair<string, string>>::const_iterator itr 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); batch.Put(itr->first, itr->second);
} }
Status st = db_->Write(WriteOptions(), &batch); Status st = db_->Write(WriteOptions(), &batch);