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] Don't copy a string in mi_cmd_disassemble


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

commit 9813429a729dbcd761dfbb02d2d7a3449af0881d
Author: Tom Tromey <tom@tromey.com>
Date:   Wed May 3 17:28:08 2017 -0600

    Don't copy a string in mi_cmd_disassemble
    
    This string copy in mi_cmd_disassemble seems not to be needed, so
    don't do it.
    
    gdb/ChangeLog
    2017-09-29  Tom Tromey  <tom@tromey.com>
    
    	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Don't copy "oarg".

Diff:
---
 gdb/ChangeLog         | 4 ++++
 gdb/mi/mi-cmd-disas.c | 6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2aaaabe..004e0b0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2017-09-29  Tom Tromey  <tom@tromey.com>
 
+	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Don't copy "oarg".
+
+2017-09-29  Tom Tromey  <tom@tromey.com>
+
 	* varobj.h (varobj_gen_name): Return std::string.
 	* varobj.c (varobj_gen_name): Return std::string.
 	* mi/mi-cmd-var.c (mi_cmd_var_create): Use std::string.
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index d0f9b0b..b3d6245 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -74,7 +74,6 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
   int how_many = -1;
   CORE_ADDR low = 0;
   CORE_ADDR high = 0;
-  struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
 
   /* Options processing stuff.  */
   int oind = 0;
@@ -104,9 +103,8 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
       switch ((enum opt) opt)
 	{
 	case FILE_OPT:
-	  file_string = xstrdup (oarg);
+	  file_string = oarg;
 	  file_seen = 1;
-	  make_cleanup (xfree, file_string);
 	  break;
 	case LINE_OPT:
 	  line_num = atoi (oarg);
@@ -190,6 +188,4 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
   gdb_disassembly (gdbarch, uiout,
   		   disasm_flags,
 		   how_many, low, high);
-
-  do_cleanups (cleanups);
 }


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