diff src/ov-fcn-handle.cc @ 10066:2cd940306a06

make unwind_protect frames local
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 06 Jan 2010 13:18:41 +0100
parents ac69e6f4b33d
children 090173f2db40
line wrap: on
line diff
--- a/src/ov-fcn-handle.cc	Tue Jan 05 13:16:16 2010 +0100
+++ b/src/ov-fcn-handle.cc	Wed Jan 06 13:18:41 2010 +0100
@@ -379,18 +379,18 @@
 
       pos = is.tellg ();
 
-      unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
+      unwind_protect_safe frame;
 
       // Set up temporary scope to use for evaluating the text that
       // defines the anonymous function.
 
       symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      unwind_protect::add_fcn (symbol_table::erase_scope, local_scope);
+      frame.add_fcn (symbol_table::erase_scope, local_scope);
 
       symbol_table::set_scope (local_scope);
 
       octave_call_stack::push (local_scope, 0);
-      unwind_protect::add_fcn (octave_call_stack::pop);
+      frame.add_fcn (octave_call_stack::pop);
 
       octave_idx_type len = 0;
 
@@ -450,8 +450,6 @@
 	}
       else
 	success = false;
-
-      unwind_protect::run_frame (uwp_frame);
     }
   else
     success = set_fcn (octaveroot, fpath);
@@ -560,18 +558,18 @@
       OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
       is.get (ctmp2, tmp+1, 0);
 
-      unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
+      unwind_protect_safe frame;
 
       // Set up temporary scope to use for evaluating the text that
       // defines the anonymous function.
 
       symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      unwind_protect::add_fcn (symbol_table::erase_scope, local_scope);	      
+      frame.add_fcn (symbol_table::erase_scope, local_scope);	      
 
       symbol_table::set_scope (local_scope);
 
       octave_call_stack::push (local_scope, 0);
-      unwind_protect::add_fcn (octave_call_stack::pop);
+      frame.add_fcn (octave_call_stack::pop);
 
       if (len > 0)
 	{
@@ -620,8 +618,6 @@
 	  else
 	    success = false;
 	}
-
-      unwind_protect::run_frame (uwp_frame);
     }
   else
     {
@@ -1057,18 +1053,18 @@
       H5Eset_auto (err_func, err_func_data);
 #endif
 
-      unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
+      unwind_protect_safe frame;
 
       // Set up temporary scope to use for evaluating the text that
       // defines the anonymous function.
 
       symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      unwind_protect::add_fcn (symbol_table::erase_scope, local_scope);
+      frame.add_fcn (symbol_table::erase_scope, local_scope);
 
       symbol_table::set_scope (local_scope);
 
       octave_call_stack::push (local_scope, 0);
-      unwind_protect::add_fcn (octave_call_stack::pop);
+      frame.add_fcn (octave_call_stack::pop);
 
       if (len > 0 && success)
 	{
@@ -1132,7 +1128,7 @@
 	    success = false;
 	}
 
-      unwind_protect::run_frame (uwp_frame);
+      frame.run ();
     }
   else
     {