diff mbox

[13/15] src/osd/osd_types.h: pass function parameter by reference

Message ID 1360266123-28972-14-git-send-email-danny.al-gaaf@bisect.de (mailing list archive)
State New, archived
Headers show

Commit Message

Danny Al-Gaaf Feb. 7, 2013, 7:42 p.m. UTC
Fix "(performance) Function parameter 'e' should be passed by reference."
from cppchecker.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
---
 src/osd/osd_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sage Weil Feb. 10, 2013, 6 a.m. UTC | #1
On Thu, 7 Feb 2013, Danny Al-Gaaf wrote:
> Fix "(performance) Function parameter 'e' should be passed by reference."
> from cppchecker.

eversion_t is only 12-16 bytes (depending on alignment), so I'm not sure a 
pointer indirection (or whatever the compiler turns the & parameter into) 
is going to buy us anything.

> 
> Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
> ---
>  src/osd/osd_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
> index e068057..b193c2b 100644
> --- a/src/osd/osd_types.h
> +++ b/src/osd/osd_types.h
> @@ -496,7 +496,7 @@ inline bool operator>(const eversion_t& l, const eversion_t& r) {
>  inline bool operator>=(const eversion_t& l, const eversion_t& r) {
>    return (l.epoch == r.epoch) ? (l.version >= r.version):(l.epoch >= r.epoch);
>  }
> -inline ostream& operator<<(ostream& out, const eversion_t e) {
> +inline ostream& operator<<(ostream& out, const eversion_t& e) {
>    return out << e.epoch << "'" << e.version;
>  }
>  
> -- 
> 1.8.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index e068057..b193c2b 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -496,7 +496,7 @@  inline bool operator>(const eversion_t& l, const eversion_t& r) {
 inline bool operator>=(const eversion_t& l, const eversion_t& r) {
   return (l.epoch == r.epoch) ? (l.version >= r.version):(l.epoch >= r.epoch);
 }
-inline ostream& operator<<(ostream& out, const eversion_t e) {
+inline ostream& operator<<(ostream& out, const eversion_t& e) {
   return out << e.epoch << "'" << e.version;
 }