From: Danny Al-Gaaf Date: Mon, 11 Mar 2013 14:23:15 +0000 (+0100) Subject: rados_sync.{cc,h}: pass some const std::string by reference X-Git-Tag: v0.60~106^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8720f520ab18aa6701bf88035b68061223d808ef;p=ceph.git rados_sync.{cc,h}: pass some const std::string by reference Signed-off-by: Danny Al-Gaaf --- diff --git a/src/rados_sync.cc b/src/rados_sync.cc index ab9c46f6e695..81c32a43cd79 100644 --- a/src/rados_sync.cc +++ b/src/rados_sync.cc @@ -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_) { diff --git a/src/rados_sync.h b/src/rados_sync.h index 7e53f491c58d..83ced528f694 100644 --- a/src/rados_sync.h +++ b/src/rados_sync.h @@ -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;