changeset 31729:c581f5ce5656

avoid an unnecessary use of __get_interpreter__ * cellfun.cc (get_output_list): Make first argument a reference to the interpreter instead of the error_system. Change all callers. Move call to interpreter::get_error_system here from Farrayfun.
author John W. Eaton <jwe@octave.org>
date Thu, 12 Jan 2023 08:40:45 -0500
parents 59923ee35263
children 610a85b0ff62
files libinterp/corefcn/cellfun.cc
diffstat 1 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Thu Jan 12 08:21:23 2023 -0500
+++ b/libinterp/corefcn/cellfun.cc	Thu Jan 12 08:40:45 2023 -0500
@@ -68,11 +68,9 @@
 OCTAVE_BEGIN_NAMESPACE(octave)
 
 static octave_value_list
-get_output_list (error_system& es,
-                 octave_idx_type count, octave_idx_type nargout,
-                 const octave_value_list& inputlist,
-                 octave_value& fcn,
-                 octave_value& error_handler)
+get_output_list (interpreter& interp, octave_idx_type count,
+                 octave_idx_type nargout, const octave_value_list& inputlist,
+                 octave_value& fcn, octave_value& error_handler)
 {
   octave_value_list tmp;
 
@@ -86,7 +84,7 @@
     {
       if (error_handler.is_defined ())
         {
-          interpreter& interp = __get_interpreter__ ();
+          error_system& es = interp.get_error_system ();
 
           es.save_exception (ee);
           interp.recover_from_exception ();
@@ -101,6 +99,8 @@
     {
       if (error_handler.is_defined ())
         {
+          error_system& es = interp.get_error_system ();
+
           octave_scalar_map msg;
           msg.assign ("identifier", es.last_error_id ());
           msg.assign ("message", es.last_error_message ());
@@ -537,8 +537,6 @@
         }
     }
 
-  error_system& es = interp.get_error_system ();
-
   // Apply functions.
 
   if (uniform_output)
@@ -559,7 +557,7 @@
             }
 
           const octave_value_list tmp
-            = get_output_list (es, count, nargout, inputlist, fcn,
+            = get_output_list (interp, count, nargout, inputlist, fcn,
                                error_handler);
 
           int tmp_numel = tmp.length ();
@@ -645,7 +643,7 @@
             }
 
           const octave_value_list tmp
-            = get_output_list (es, count, nargout, inputlist, fcn,
+            = get_output_list (interp, count, nargout, inputlist, fcn,
                                error_handler);
 
           if (nargout > 0 && tmp.length () < nargout)
@@ -1300,7 +1298,7 @@
                 }
 
               const octave_value_list tmp
-                = get_output_list (es, count, nargout, inputlist, fcn,
+                = get_output_list (interp, count, nargout, inputlist, fcn,
                                    error_handler);
 
               if (nargout > 0 && tmp.length () < nargout)
@@ -1392,7 +1390,7 @@
                 }
 
               const octave_value_list tmp
-                = get_output_list (es, count, nargout, inputlist, fcn,
+                = get_output_list (interp, count, nargout, inputlist, fcn,
                                    error_handler);
 
               if (nargout > 0 && tmp.length () < nargout)