Mercurial > octave
changeset 29299:20092ae957da
Add discard() as an alias for set() for unwind_actions.
* unwind-prot.h (unwind_action, unwind_action_safe): Add new member function
discard() which calls set() with no arguments.
* unwind-prot.h (unwind_action::run, unwind_action_safe::run): Replace call to
set() with call to discard().
* __ftp__.cc (F__ftp_mget__), urlwrite.cc (Furlwrite),
url-transfer.cc (base_url_transfer::mget_directory): Replace calls to set()
with discard().
author | Rik <rik@octave.org> |
---|---|
date | Sat, 16 Jan 2021 11:50:42 -0800 |
parents | 2034a2ab58d8 |
children | 1ece396fe3df |
files | libinterp/corefcn/__ftp__.cc libinterp/corefcn/urlwrite.cc liboctave/util/unwind-prot.h liboctave/util/url-transfer.cc |
diffstat | 4 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/__ftp__.cc Sat Jan 16 10:44:40 2021 -0800 +++ b/libinterp/corefcn/__ftp__.cc Sat Jan 16 11:50:42 2021 -0800 @@ -506,7 +506,7 @@ ofile.close (); if (url_xfer.good ()) - delete_file.set (); + delete_file.discard (); } if (! url_xfer.good ())
--- a/libinterp/corefcn/urlwrite.cc Sat Jan 16 10:44:40 2021 -0800 +++ b/libinterp/corefcn/urlwrite.cc Sat Jan 16 11:50:42 2021 -0800 @@ -157,7 +157,7 @@ ofile.close (); if (url_xfer.good ()) - unlink_action.set (); + unlink_action.discard (); if (nargout > 0) {
--- a/liboctave/util/unwind-prot.h Sat Jan 16 10:44:40 2021 -0800 +++ b/liboctave/util/unwind-prot.h Sat Jan 16 11:50:42 2021 -0800 @@ -195,13 +195,16 @@ void set (void) { m_fcn = nullptr; } + // Alias for set() which is clearer about programmer intention. + void discard (void) { set (); } + void run (void) { if (m_fcn) m_fcn (); // Invalidate so action won't run again when object is deleted. - set (); + discard (); } private: @@ -250,6 +253,9 @@ void set (void) { m_fcn = nullptr; } + // Alias for set() which is clearer about programmer intention. + void discard (void) { set (); } + void run (void) { try @@ -263,7 +269,7 @@ } // Invalidate so action won't run again when object is deleted. - set (); + discard (); } private: