From 7fb723f58130d583b4981432c6e27d8800ccbea6 Mon Sep 17 00:00:00 2001 From: yaphet <4414314+darionyaphet@users.noreply.github.com> Date: Thu, 27 Jan 2022 11:34:20 -0800 Subject: [PATCH] Using back to get the last element (#9415) Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/9415 Reviewed By: ajkr Differential Revision: D33773673 Pulled By: riversand963 fbshipit-source-id: 52b59ec5a6b01a91d3f990b7f2b0f16320afb49b --- tools/ldb_cmd.cc | 2 +- tools/ldb_cmd_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index 3725cf3ba..ef101757f 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -1191,7 +1191,7 @@ void ManifestDumpCommand::DoCommand() { exec_state_ = LDBCommandExecuteResult::Failed(err_msg); return; } - if (db_path_[db_path_.length() - 1] != '/') { + if (db_path_.back() != '/') { db_path_.append("/"); } manifestfile = db_path_ + matched_file; diff --git a/tools/ldb_cmd_test.cc b/tools/ldb_cmd_test.cc index 3bc6ea980..c0e412789 100644 --- a/tools/ldb_cmd_test.cc +++ b/tools/ldb_cmd_test.cc @@ -187,7 +187,7 @@ class FileChecksumTestHelper { Status VerifyChecksumInManifest( const std::vector& live_files) { // Step 1: verify if the dbname_ is correct - if (dbname_[dbname_.length() - 1] != '/') { + if (dbname_.back() != '/') { dbname_.append("/"); }