This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove last cleanup solib-aix.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=724127627fef458ed330d027cf0b3d17580af615

commit 724127627fef458ed330d027cf0b3d17580af615
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Jan 24 06:38:59 2019 -0700

    Remove last cleanup solib-aix.c
    
    This removes the last cleanup solib-aix.c, replacing it with a use of
    make_scope_exit.
    
    2019-03-06  Tom Tromey  <tom@tromey.com>
    
    	* solib-aix.c: Use make_scope_exit.

Diff:
---
 gdb/ChangeLog   |  4 ++++
 gdb/solib-aix.c | 10 ++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0a3698e..0dc54e7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2019-03-06  Tom Tromey  <tom@tromey.com>
 
+	* solib-aix.c: Use make_scope_exit.
+
+2019-03-06  Tom Tromey  <tom@tromey.com>
+
 	* solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct):
 	Use make_scope_exit.
 
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 85c05a4..ab4f362 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -26,6 +26,7 @@
 #include "xcoffread.h"
 #include "observable.h"
 #include "gdbcmd.h"
+#include "common/scope-exit.h"
 
 /* Variable controlling the output of the debugging traces for
    this module.  */
@@ -242,18 +243,19 @@ static VEC (lm_info_aix_p) *
 solib_aix_parse_libraries (const char *library)
 {
   VEC (lm_info_aix_p) *result = NULL;
-  struct cleanup *back_to = make_cleanup (solib_aix_free_library_list,
-                                          &result);
+  auto cleanup = make_scope_exit ([&] ()
+    {
+      solib_aix_free_library_list (&result);
+    });
 
   if (gdb_xml_parse_quick (_("aix library list"), "library-list-aix.dtd",
                            library_list_elements, library, &result) == 0)
     {
       /* Parsed successfully, keep the result.  */
-      discard_cleanups (back_to);
+      cleanup.release ();
       return result;
     }
 
-  do_cleanups (back_to);
   return NULL;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]