From 655a9d806ee7259658f47f3ff29f690cf175c13c Mon Sep 17 00:00:00 2001 From: Zuri Obozuwa Date: Fri, 15 Mar 2024 01:59:46 +0000 Subject: [PATCH] Fix passing of string input parameter to Enable method of DebugInfoSelection struct Use const ref to input string instead of incurring the cost of copying the input string --- liblangutil/DebugInfoSelection.cpp | 2 +- liblangutil/DebugInfoSelection.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/liblangutil/DebugInfoSelection.cpp b/liblangutil/DebugInfoSelection.cpp index 88e09cdb7aa0..ad0b615c1c1e 100644 --- a/liblangutil/DebugInfoSelection.cpp +++ b/liblangutil/DebugInfoSelection.cpp @@ -83,7 +83,7 @@ std::optional DebugInfoSelection::fromComponents( return selection; } -bool DebugInfoSelection::enable(std::string _component) +bool DebugInfoSelection::enable(std::string const& _component) { auto memberIt = componentMap().find(boost::trim_copy(_component)); if (memberIt == componentMap().end()) diff --git a/liblangutil/DebugInfoSelection.h b/liblangutil/DebugInfoSelection.h index 40ba3d6b2573..3a9432de6d02 100644 --- a/liblangutil/DebugInfoSelection.h +++ b/liblangutil/DebugInfoSelection.h @@ -49,7 +49,7 @@ struct DebugInfoSelection std::vector const& _componentNames, bool _acceptWildcards = false ); - bool enable(std::string _component); + bool enable(std::string const& _component); bool all() const noexcept; bool any() const noexcept;