changeset 29248:37584021e209 stable

load-path.cc: Avoid copying string for loop variable. * libinterp/corefcn/load-path.cc (Frmpath): Use reference to string as loop variable to avoid creating a copy.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 02 Jan 2021 19:27:08 +0100
parents 8acb139a923c
children 70ae19d4e67b 216ef81dafb6
files libinterp/corefcn/load-path.cc
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc	Thu Dec 31 17:31:31 2020 +0100
+++ b/libinterp/corefcn/load-path.cc	Sat Jan 02 19:27:08 2021 +0100
@@ -2666,7 +2666,7 @@
       std::string arg = args(i).xstring_value ("rmpath: all arguments must be strings");
       std::list<std::string> dir_elts = octave::split_path (arg);
 
-      for (const auto dir : dir_elts)
+      for (const auto& dir : dir_elts)
         {
           //dir = regexprep (dir_elts{j}, '//+', "/");
           //dir = regexprep (dir, '/$', "");