Remove duplicate code in execute_fn_to_string using SCOPE_EXIT.
Tested on aarch64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
{
string_file str_file (term_out);
- try
- {
- execute_fn_to_ui_file (&str_file, fn);
- }
- catch (...)
- {
- /* Finally. */
- res = str_file.release ();
- throw;
- }
+ SCOPE_EXIT { res = str_file.release (); };
- /* And finally. */
- res = str_file.release ();
+ execute_fn_to_ui_file (&str_file, fn);
}
/* See top.h. */