Use gdb::def_vector in func_command
authorTom Tromey <tom@tromey.com>
Wed, 6 Sep 2017 22:03:28 +0000 (16:03 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 9 Sep 2017 20:10:48 +0000 (14:10 -0600)
This changes func_command to use gdb::def_vector, removing a cleanup.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

* stack.c (func_command): Use gdb::def_vector.

gdb/ChangeLog
gdb/stack.c

index a05e6358162e43ee6abdceddd0bca7548a85c27b..2ccf4e68326cd826b9143db2aedb49ff7ba43350 100644 (file)
@@ -1,3 +1,7 @@
+2017-09-09  Tom Tromey  <tom@tromey.com>
+
+       * stack.c (func_command): Use gdb::def_vector.
+
 2017-09-09  Tom Tromey  <tom@tromey.com>
 
        * mi/mi-cmd-var.c (mi_cmd_var_list_children): Use gdb::optional,
index a3bc9a3b2e280364eefdf89dec052408fe14969b..24330099a993adc2bc1ace8dbbdd38ecf195772f 100644 (file)
@@ -52,6 +52,7 @@
 #include "symfile.h"
 #include "extension.h"
 #include "observer.h"
+#include "common/def-vector.h"
 
 /* The possible choices of "set print frame-arguments", and the value
    of this setting.  */
@@ -2521,7 +2522,6 @@ func_command (char *arg, int from_tty)
   struct frame_info *frame;
   int found = 0;
   int level = 1;
-  struct function_bounds *func_bounds = NULL;
 
   if (arg == NULL)
     return;
@@ -2529,8 +2529,7 @@ func_command (char *arg, int from_tty)
   frame = get_current_frame ();
   std::vector<symtab_and_line> sals
     = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE);
-  func_bounds = XNEWVEC (struct function_bounds, sals.size ());
-  struct cleanup *cleanups = make_cleanup (xfree, func_bounds);
+  gdb::def_vector<function_bounds> func_bounds (sals.size ());
   for (size_t i = 0; (i < sals.size () && !found); i++)
     {
       if (sals[i].pspace != current_program_space)
@@ -2557,8 +2556,6 @@ func_command (char *arg, int from_tty)
     }
   while (!found && level == 0);
 
-  do_cleanups (cleanups);
-
   if (!found)
     printf_filtered (_("'%s' not within current stack frame.\n"), arg);
   else if (frame != get_selected_frame (NULL))
This page took 0.033409 seconds and 4 git commands to generate.