Use std::string in break-catch-sig.c
authorTom Tromey <tom@tromey.com>
Thu, 22 Sep 2016 15:50:50 +0000 (09:50 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 23 Sep 2016 17:37:06 +0000 (11:37 -0600)
This changes one spot in break-catch-sig.c to use std::string,
removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

* break-catch-sig.c: Include <string>.
(signal_catchpoint_print_one): Use std::string.

gdb/ChangeLog
gdb/break-catch-sig.c

index fe3ea4283cd671b131cc9a8126aface4a9937b90..8c8b18a6786f39f8a4b62ade06ab49f671390025 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-23  Tom Tromey  <tom@tromey.com>
+
+       * break-catch-sig.c: Include <string>.
+       (signal_catchpoint_print_one): Use std::string.
+
 2016-09-23  Tom Tromey  <tom@tromey.com>
 
        * utils.c (struct restore_ui_out_closure): Remove.
index 06ee44c1ca9035219e8c8efa79037717ee2d5d09..296f900b5c898f9c152b25050747266c09a7f96c 100644 (file)
@@ -28,7 +28,8 @@
 #include "valprint.h"
 #include "cli/cli-utils.h"
 #include "completer.h"
-#include "gdb_obstack.h"
+
+#include <string>
 
 #define INTERNAL_SIGNAL(x) ((x) == GDB_SIGNAL_TRAP || (x) == GDB_SIGNAL_INT)
 
@@ -265,11 +266,7 @@ signal_catchpoint_print_one (struct breakpoint *b,
     {
       int i;
       gdb_signal_type iter;
-      struct obstack text;
-      struct cleanup *cleanup;
-
-      obstack_init (&text);
-      cleanup = make_cleanup_obstack_free (&text);
+      std::string text;
 
       for (i = 0;
            VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
@@ -278,12 +275,10 @@ signal_catchpoint_print_one (struct breakpoint *b,
          const char *name = signal_to_name_or_int (iter);
 
          if (i > 0)
-           obstack_grow (&text, " ", 1);
-         obstack_grow (&text, name, strlen (name));
+           text += " ";
+         text += name;
         }
-      obstack_grow (&text, "", 1);
-      ui_out_field_string (uiout, "what", (const char *) obstack_base (&text));
-      do_cleanups (cleanup);
+      ui_out_field_string (uiout, "what", text.c_str ());
     }
   else
     ui_out_field_string (uiout, "what",
This page took 0.028697 seconds and 4 git commands to generate.