]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados_sync.{cc,h}: pass some const std::string by reference
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 11 Mar 2013 14:23:15 +0000 (15:23 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 11 Mar 2013 14:23:15 +0000 (15:23 +0100)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/rados_sync.cc
src/rados_sync.h

index ab9c46f6e6959d31e281b622dd7651a38f558311..81c32a43cd79909bdae018da59575378c4137674 100644 (file)
@@ -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_)
 {
index 7e53f491c58d4b21b765d96dc80ee9649b3d5618..83ced528f694c917c533fc77848b27d03b4064f3 100644 (file)
@@ -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;