summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-10-06 17:14:26 -0400
committerDavid Robillard <d@drobilla.net>2024-10-11 19:55:55 -0400
commit83ad9c6c4d015ff1a8075bf69036d284af24a18e (patch)
treed280c95347ab6b13e86fcedd6549daee122ed73d
parentc7d1976928e5d2e1c22b6cc8ac67083c60eae0a1 (diff)
downloadingen-83ad9c6c4d015ff1a8075bf69036d284af24a18e.tar.gz
ingen-83ad9c6c4d015ff1a8075bf69036d284af24a18e.tar.bz2
ingen-83ad9c6c4d015ff1a8075bf69036d284af24a18e.zip
Pass strings and large structures by const reference
-rw-r--r--.suppress.cppcheck1
-rw-r--r--include/ingen/ClashAvoider.hpp6
-rw-r--r--include/ingen/URI.hpp4
-rw-r--r--src/ClashAvoider.cpp6
-rw-r--r--src/URI.cpp4
5 files changed, 10 insertions, 11 deletions
diff --git a/.suppress.cppcheck b/.suppress.cppcheck
index 226742e1..44919591 100644
--- a/.suppress.cppcheck
+++ b/.suppress.cppcheck
@@ -12,7 +12,6 @@ missingReturn
noExplicitConstructor
normalCheckLevelMaxBranches
nullPointerArithmetic
-passedByValue
shadowFunction
unsafeClassCanLeak
useStlAlgorithm
diff --git a/include/ingen/ClashAvoider.hpp b/include/ingen/ClashAvoider.hpp
index c1d62754..c0091fbc 100644
--- a/include/ingen/ClashAvoider.hpp
+++ b/include/ingen/ClashAvoider.hpp
@@ -48,9 +48,9 @@ public:
* @param new_path The new path that `old_path` was mapped to
* @param name The old name.
*/
- static std::string adjust_name(const raul::Path& old_path,
- const raul::Path& new_path,
- std::string name);
+ static std::string adjust_name(const raul::Path& old_path,
+ const raul::Path& new_path,
+ const std::string& name);
private:
using Offsets = std::map<raul::Path, unsigned>;
diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp
index a45fb268..959f2290 100644
--- a/include/ingen/URI.hpp
+++ b/include/ingen/URI.hpp
@@ -40,7 +40,7 @@ public:
explicit URI(const char* str);
URI(const std::string& str, const URI& base);
URI(const Sord::Node& node);
- URI(SerdNode node);
+ URI(const SerdNode& node);
explicit URI(const FilePath& path);
URI(const URI& uri);
@@ -98,7 +98,7 @@ public:
}
private:
- URI(SerdNode node, SerdURI uri);
+ URI(const SerdNode& node, const SerdURI& uri);
static Chunk make_chunk(const SerdChunk& chunk) {
return {reinterpret_cast<const char*>(chunk.buf), chunk.len};
diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp
index a4f9fbee..0ed1da73 100644
--- a/src/ClashAvoider.cpp
+++ b/src/ClashAvoider.cpp
@@ -152,9 +152,9 @@ numeric_suffix_start(const std::string& str)
}
std::string
-ClashAvoider::adjust_name(const raul::Path& old_path,
- const raul::Path& new_path,
- std::string name)
+ClashAvoider::adjust_name(const raul::Path& old_path,
+ const raul::Path& new_path,
+ const std::string& name)
{
const auto name_suffix_start = numeric_suffix_start(name);
if (!name_suffix_start) {
diff --git a/src/URI.cpp b/src/URI.cpp
index c4020c4d..81dd5686 100644
--- a/src/URI.cpp
+++ b/src/URI.cpp
@@ -52,14 +52,14 @@ URI::URI(const std::string& str, const URI& base)
{
}
-URI::URI(SerdNode node)
+URI::URI(const SerdNode& node)
: _uri(SERD_URI_NULL)
, _node(serd_node_new_uri_from_node(&node, nullptr, &_uri))
{
assert(node.type == SERD_URI);
}
-URI::URI(SerdNode node, SerdURI uri) : _uri(uri), _node(node)
+URI::URI(const SerdNode& node, const SerdURI& uri) : _uri(uri), _node(node)
{
assert(node.type == SERD_URI);
}