Mercurial > octave
diff libinterp/corefcn/oct-hist.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 | 159b6a1eb408 |
children | 445e5ac1f58d |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-hist.cc Wed Sep 30 08:59:11 2020 +0200 +++ b/libinterp/corefcn/oct-hist.cc Wed Sep 30 03:17:52 2020 -0700 @@ -327,12 +327,14 @@ { bool numbered_output = nargout == 0; - unwind_protect frame; + octave::unwind_action restore_history_filename + ([] (const auto& old_filename) + { + command_history::set_file (old_filename); + }, command_history::file ()); string_vector hlist; - frame.add_fcn (command_history::set_file, command_history::file ()); - int nargin = args.length (); // Number of history lines to show (-1 = all)