From 6f8db0b9be78354142fbbbebef021f96005a2455 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Wed, 30 Jun 2021 09:08:52 +0300 Subject: [PATCH] common: optimize op_target_t and hobject_t constructors Switch to passing on arguments by reference instead of copying them. Signed-off-by: Or Ozeri --- src/common/hobject.h | 6 +++--- src/osdc/Objecter.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/hobject.h b/src/common/hobject.h index b7d4895c33ed..2fe722661c61 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -130,8 +130,8 @@ public: return hobject_t_max(); } - hobject_t(object_t oid, const std::string& key, snapid_t snap, uint32_t hash, - int64_t pool, std::string nspace) + hobject_t(const object_t& oid, const std::string& key, snapid_t snap, + uint32_t hash, int64_t pool, const std::string& nspace) : oid(oid), snap(snap), hash(hash), max(false), pool(pool), nspace(nspace), key(oid.name == key ? std::string() : key) { @@ -139,7 +139,7 @@ public: } hobject_t(const sobject_t &soid, const std::string &key, uint32_t hash, - int64_t pool, std::string nspace) + int64_t pool, const std::string& nspace) : oid(soid.oid), snap(soid.snap), hash(hash), max(false), pool(pool), nspace(nspace), key(soid.oid.name == key ? std::string() : key) { diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index e4c7ab4b4b6a..b67f0c712993 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1793,7 +1793,7 @@ public: epoch_t last_force_resend = 0; - op_target_t(object_t oid, object_locator_t oloc, int flags) + op_target_t(const object_t& oid, const object_locator_t& oloc, int flags) : flags(flags), base_oid(oid), base_oloc(oloc) -- 2.47.3