From: liuchang0812 Date: Tue, 28 Feb 2017 08:59:41 +0000 (+0800) Subject: common: use ref to avoid unnecessary memory copy X-Git-Tag: v12.0.1~200^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d873e248338b51cf31b23d3f103f773f3b01c0ce;p=ceph.git common: use ref to avoid unnecessary memory copy Fixes: http://tracker.ceph.com/issues/19107 Signed-off-by: liuchang0812 --- diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index d24990f97192..2c403d950c8f 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -40,8 +40,8 @@ using std::string; ////////////////////////////// ConfLine ////////////////////////////// ConfLine:: -ConfLine(const std::string &key_, const std::string val_, - const std::string newsection_, const std::string comment_, int line_no_) +ConfLine(const std::string &key_, const std::string &val_, + const std::string &newsection_, const std::string &comment_, int line_no_) : key(key_), val(val_), newsection(newsection_) { // If you want to implement writable ConfFile support, you'll need to save diff --git a/src/common/ConfUtils.h b/src/common/ConfUtils.h index 7a5b79a047a1..19ec188a7112 100644 --- a/src/common/ConfUtils.h +++ b/src/common/ConfUtils.h @@ -39,8 +39,8 @@ */ class ConfLine { public: - ConfLine(const std::string &key_, const std::string val_, - const std::string newsection_, const std::string comment_, int line_no_); + ConfLine(const std::string &key_, const std::string &val_, + const std::string &newsection_, const std::string &comment_, int line_no_); bool operator<(const ConfLine &rhs) const; friend std::ostream &operator<<(std::ostream& oss, const ConfLine &l);