changeset 31864:359de694adce

avoid unneccessary string initialization (patch #10218) * load-path.cc (load_path::package_info::find_fcn): Don't reinitialize retval unnecessarily.
author Petter Tomner <tomner@kth.se>
date Tue, 28 Feb 2023 09:42:20 -0500
parents 409d1ef1e0a1
children f3a6f41314ed
files libinterp/corefcn/load-path.cc
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc	Mon Feb 27 12:18:44 2023 -0800
+++ b/libinterp/corefcn/load-path.cc	Tue Feb 28 09:42:20 2023 -0500
@@ -1745,11 +1745,10 @@
 
           retval = find_method (class_name, meth, dir_name);
         }
-      else
-        retval = "";
     }
   else
     {
+      // Ensure that dir_name is empty if function is not found.
       dir_name = "";
 
       const_fcn_map_iterator p = m_fcn_map.find (fcn);
@@ -1819,6 +1818,7 @@
 
   //  update ();
 
+  // Ensure that dir_name is empty if method is not found.
   dir_name = "";
 
   const_method_map_iterator q = m_method_map.find (class_name);