summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-10-06 16:32:41 -0400
committerDavid Robillard <d@drobilla.net>2024-10-06 18:40:03 -0400
commit5fe9b2cd3e7ff8f7f23075c980e36d7d456788a8 (patch)
treec62f1bfc0046ae9a952df2e32f5d23c6aed24a6c /src/gui
parent45bd400f71e574bfa2670f13f7c1611ab2089903 (diff)
downloadingen-5fe9b2cd3e7ff8f7f23075c980e36d7d456788a8.tar.gz
ingen-5fe9b2cd3e7ff8f7f23075c980e36d7d456788a8.tar.bz2
ingen-5fe9b2cd3e7ff8f7f23075c980e36d7d456788a8.zip
Avoid inefficient use of substr() to set strings to a prefix
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphCanvas.cpp2
-rw-r--r--src/gui/LoadGraphWindow.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 6d5c3b5a..2c08fb47 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -735,7 +735,7 @@ GraphCanvas::paste()
if (base_uri) {
std::string base = *base_uri;
if (base[base.size() - 1] == '/') {
- base = base.substr(0, base.size() - 1);
+ base.resize(base.size() - 1);
}
copy_root = uri_to_path(URI(base));
}
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index 794cfe71..b118effb 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -237,7 +237,7 @@ raul::Symbol
LoadGraphWindow::symbol_from_filename(const Glib::ustring& filename)
{
std::string symbol_str = Glib::path_get_basename(get_filename());
- symbol_str = symbol_str.substr(0, symbol_str.find('.'));
+ symbol_str.resize(symbol_str.find('.'));
return raul::Symbol::symbolify(symbol_str);
}