mirror of
https://github.com/ceph/ceph
synced 2025-02-07 10:53:30 +00:00
rados_sync.{cc,h}: pass some const std::string by reference
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
315c8c3ec3
commit
8720f520ab
@ -68,7 +68,7 @@ bool is_suffix(const char *str, const char *suffix)
|
||||
return (strcmp(str + (strlen_str - strlen_suffix), suffix) == 0);
|
||||
}
|
||||
|
||||
ExportDir* ExportDir::create_for_writing(const std::string path, int version,
|
||||
ExportDir* ExportDir::create_for_writing(const std::string &path, int version,
|
||||
bool create)
|
||||
{
|
||||
if (access(path.c_str(), R_OK | W_OK) == 0) {
|
||||
@ -101,7 +101,7 @@ ExportDir* ExportDir::create_for_writing(const std::string path, int version,
|
||||
return new ExportDir(version, path);
|
||||
}
|
||||
|
||||
ExportDir* ExportDir::from_file_system(const std::string path)
|
||||
ExportDir* ExportDir::from_file_system(const std::string &path)
|
||||
{
|
||||
if (access(path.c_str(), R_OK)) {
|
||||
cerr << "ExportDir: source directory '" << path
|
||||
@ -141,7 +141,7 @@ ExportDir* ExportDir::from_file_system(const std::string path)
|
||||
return new ExportDir(ret, path);
|
||||
}
|
||||
|
||||
std::string ExportDir::get_fs_path(const std::string rados_name) const
|
||||
std::string ExportDir::get_fs_path(const std::string &rados_name) const
|
||||
{
|
||||
static int HASH_LENGTH = 17;
|
||||
size_t i;
|
||||
@ -214,7 +214,7 @@ std::string ExportDir::get_fs_path(const std::string rados_name) const
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
ExportDir::ExportDir(int version_, const std::string path_)
|
||||
ExportDir::ExportDir(int version_, const std::string &path_)
|
||||
: version(version_),
|
||||
path(path_)
|
||||
{
|
||||
|
@ -61,9 +61,9 @@ bool is_suffix(const char *str, const char *suffix);
|
||||
class ExportDir
|
||||
{
|
||||
public:
|
||||
static ExportDir* create_for_writing(const std::string path, int version,
|
||||
static ExportDir* create_for_writing(const std::string &path, int version,
|
||||
bool create);
|
||||
static ExportDir* from_file_system(const std::string path);
|
||||
static ExportDir* from_file_system(const std::string &path);
|
||||
|
||||
/* Given a rados object name, return something which looks kind of like the
|
||||
* first part of the name.
|
||||
@ -78,10 +78,10 @@ public:
|
||||
* correctly.
|
||||
* I guess a better hash would be nice too.
|
||||
*/
|
||||
std::string get_fs_path(const std::string rados_name) const;
|
||||
std::string get_fs_path(const std::string &rados_name) const;
|
||||
|
||||
private:
|
||||
ExportDir(int version_, const std::string path_);
|
||||
ExportDir(int version_, const std::string &path_);
|
||||
|
||||
int version;
|
||||
std::string path;
|
||||
|
Loading…
Reference in New Issue
Block a user