[v2,08/22] Remove last cleanup solib-aix.c

Message ID 20190227201849.32210-9-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Feb. 27, 2019, 8:18 p.m. UTC
  This removes the last cleanup solib-aix.c, replacing it with a use of
make_scope_exit.

gdb/ChangeLog
2019-02-27  Tom Tromey  <tom@tromey.com>

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

Comments

Pedro Alves March 6, 2019, 7:33 p.m. UTC | #1
On 02/27/2019 08:18 PM, Tom Tromey wrote:
> This removes the last cleanup solib-aix.c, replacing it with a use of
> make_scope_exit.

Other than the indentation thing, which I'll stop mentioning in
following patches, LGTM.

Thanks,
Pedro Alves
  
Tom Tromey March 6, 2019, 9:19 p.m. UTC | #2
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 02/27/2019 08:18 PM, Tom Tromey wrote:
>> This removes the last cleanup solib-aix.c, replacing it with a use of
>> make_scope_exit.

Pedro> Other than the indentation thing, which I'll stop mentioning in
Pedro> following patches, LGTM.

I wasn't totally sure from this mail if you were intending to look at
the rest of the series, so just to be clear, I'll hold off on pushing
anything until you've given the go-ahead.

thanks,
Tom
  

Patch

diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 85c05a42ebf..c5fb7d58525 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;
 }