From: Pan Liu Date: Mon, 17 Jul 2017 12:26:42 +0000 (+0800) Subject: os/bluestore: use reference to void string copy X-Git-Tag: ses5-milestone9~1^2~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16364%2Fhead;p=ceph.git os/bluestore: use reference to void string copy Signed-off-by: Pan Liu --- diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 01c2369ca6f0..a58f529a99e7 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 321653448973..6a7c0e37772b 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