diff liboctave/util/unwind-prot.h @ 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 e274759bcb12
children 7854d5752dd2
line wrap: on
line diff
--- 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: