os/bluestore: use reference to void string copy

Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
This commit is contained in:
Pan Liu 2017-07-17 20:26:42 +08:00
parent 2b3adf71c8
commit aeac0423cf
2 changed files with 5 additions and 5 deletions

View File

@ -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<string, string> str_map;
int r = get_str_map(opt_str, &str_map, ",\n;");

View File

@ -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