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

[pushed] handle_general_set: Remove useless xstrdup


Unless I'm missing something very obvious, this xstrdup seems
unnecessary to me.  We can pass "mode" directly to sprintf.

gdb/gdbserver/ChangeLog:

	* server.c (handle_general_set): Remove unnecessary xstrdup.
---
 gdb/gdbserver/ChangeLog | 4 ++++
 gdb/gdbserver/server.c  | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 70a93876db..f7de928d18 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2018-03-02  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* server.c (handle_general_set): Remove unnecessary xstrdup.
+
 2018-03-02  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* server.c (parse_debug_format_options): Adjust to
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index afdd5049a7..64c72bdd58 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -847,12 +847,9 @@ handle_general_set (char *own_buf)
 	req = TRIBOOL_TRUE;
       else
 	{
-	  char *mode_copy = xstrdup (mode);
-
 	  /* We don't know what this mode is, so complain to GDB.  */
 	  sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n",
-		   mode_copy);
-	  xfree (mode_copy);
+		   mode);
 	  return;
 	}
 
-- 
2.16.1


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