Skip to content

Commit 4cc8643

Browse files
committed
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>
1 parent af8c2b2 commit 4cc8643

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

util/ldb_cmd.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ bool LDBCommand::ParseKeyValue(const string& line, string* key, string* value,
325325
bool LDBCommand::ValidateCmdLineOptions() {
326326

327327
for (map<string, string>::const_iterator itr = option_map_.begin();
328-
itr != option_map_.end(); itr++) {
328+
itr != option_map_.end(); ++itr) {
329329
if (find(valid_cmd_line_options_.begin(),
330330
valid_cmd_line_options_.end(), itr->first) ==
331331
valid_cmd_line_options_.end()) {
@@ -335,7 +335,7 @@ bool LDBCommand::ValidateCmdLineOptions() {
335335
}
336336

337337
for (vector<string>::const_iterator itr = flags_.begin();
338-
itr != flags_.end(); itr++) {
338+
itr != flags_.end(); ++itr) {
339339
if (find(valid_cmd_line_options_.begin(),
340340
valid_cmd_line_options_.end(), *itr) ==
341341
valid_cmd_line_options_.end()) {
@@ -1538,7 +1538,7 @@ void BatchPutCommand::DoCommand() {
15381538
WriteBatch batch;
15391539

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

0 commit comments

Comments
 (0)