diff libinterp/corefcn/variables.cc @ 28823:26cfccfee9a0

Replace unwind_protect with more efficient constructs (bug #59192). * debug.cc, error.cc, ft-text-renderer.cc, load-path.cc, mex.cc, oct-hist.cc, pager.cc, rand.cc, strfns.cc, sysdep.cc, toplev.cc, variables.cc, __delaunayn__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, ov-class.cc, ov-struct.cc: Remove unwind_protect frames declared but never used. Replace frame.protect_var () instances with unwind_protect_var<> object. Replace frame.add_fcn () instances with unwind_action<> object.
author Rik <rik@octave.org>
date Wed, 30 Sep 2020 03:17:52 -0700
parents 4e10e25f0fc6
children 09c071328135
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Wed Sep 30 08:59:11 2020 +0200
+++ b/libinterp/corefcn/variables.cc	Wed Sep 30 03:17:52 2020 -0700
@@ -1399,8 +1399,8 @@
   if (val.is_defined ())
     {
       // Ensure auto-restoration.
-      octave::unwind_protect frame;
-      frame.protect_var (Vmissing_function_hook);
+      octave::unwind_protect_var<std::string>
+        restore_var (Vmissing_function_hook);
 
       // Clear the variable prior to calling the function.
       const std::string func_name = Vmissing_function_hook;