This is the mail archive of the 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]

Re: [PATCH v2 13/31] Use ui_file_as_string in gdb/arm-tdep.c

On 2016-10-18 21:12, Pedro Alves wrote:
yyyy-mm-yy  Pedro Alves  <>

	* arm-tdep.c (_initialize_arm_tdep): Use ui_file_as_string and
 gdb/arm-tdep.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 27a3ebe..31ebdc3 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9558,7 +9558,7 @@ _initialize_arm_tdep (void)
   const char *setdesc;
   const char *const *regnames;
   int i;
-  static char *helptext;
+  static std::string helptext;
   char regdesc[1024], *rdptr = regdesc;
   size_t rest = sizeof (regdesc);

@@ -9629,14 +9629,14 @@ _initialize_arm_tdep (void)
 		      _("The valid values are:\n"),
 		      _("The default is \"std\"."));
-  helptext = ui_file_xstrdup (stb, NULL);
+  helptext = ui_file_as_string (stb);
   ui_file_delete (stb);

   add_setshow_enum_cmd("disassembler", no_class,
 		       valid_disassembly_styles, &disassembly_style,
 		       _("Set the disassembly style."),
 		       _("Show the disassembly style."),
-		       helptext,
+		       helptext.c_str (),
 		       NULL, /* FIXME: i18n: The disassembly style is
 				\"%s\".  */

I think helptext doesn't need to be static. Since add_setshow_* makes its own copy, it doesn't need to stay alive after the call.

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