From aeac0423cf43a24df2ee1b2054692b58e428cc03 Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Mon, 17 Jul 2017 20:26:42 +0800 Subject: [PATCH] os/bluestore: use reference to void string copy Signed-off-by: Pan Liu --- src/kv/RocksDBStore.cc | 6 +++--- src/kv/RocksDBStore.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 01c2369ca6f..a58f529a99e 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -139,7 +139,7 @@ rocksdb::Logger *create_rocksdb_ceph_logger() return new CephRocksdbLogger(g_ceph_context); } -int string2bool(string val, bool &b_val) +static int string2bool(const string &val, bool &b_val) { if (strcasecmp(val.c_str(), "false") == 0) { b_val = false; @@ -157,7 +157,7 @@ int string2bool(string val, bool &b_val) } } -int RocksDBStore::tryInterpret(const string key, const string val, rocksdb::Options &opt) +int RocksDBStore::tryInterpret(const string &key, const string &val, rocksdb::Options &opt) { if (key == "compaction_threads") { std::string err; @@ -188,7 +188,7 @@ int RocksDBStore::tryInterpret(const string key, const string val, rocksdb::Opti return 0; } -int RocksDBStore::ParseOptionsFromString(const string opt_str, rocksdb::Options &opt) +int RocksDBStore::ParseOptionsFromString(const string &opt_str, rocksdb::Options &opt) { map str_map; int r = get_str_map(opt_str, &str_map, ",\n;"); diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index 32165344897..6a7c0e37772 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -108,8 +108,8 @@ public: bool enable_rmrange; void compact() override; - int tryInterpret(const string key, const string val, rocksdb::Options &opt); - int ParseOptionsFromString(const string opt_str, rocksdb::Options &opt); + int tryInterpret(const string& key, const string& val, rocksdb::Options &opt); + int ParseOptionsFromString(const string& opt_str, rocksdb::Options &opt); static int _test_init(const string& dir); int init(string options_str) override; /// compact rocksdb for all keys with a given prefix -- 2.39.5