gdbserver does not need xstrdup

Message ID 20191010171437.11145-1-tromey@adacore.com
State New, archived
Headers

Commit Message

Tom Tromey Oct. 10, 2019, 5:14 p.m. UTC
  gdbserver has its own implementation of xstrdup.  However, because
gdbserver links against libiberty now, I think this is not needed.
This patch removes it.

gdb/gdbserver/ChangeLog
2019-09-03  Tom Tromey  <tromey@adacore.com>

	* utils.c (xstrdup): Remove.
---
 gdb/gdbserver/ChangeLog |  4 ++++
 gdb/gdbserver/utils.c   | 12 ------------
 2 files changed, 4 insertions(+), 12 deletions(-)
  

Comments

Tom Tromey Oct. 25, 2019, 2:22 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> gdbserver has its own implementation of xstrdup.  However, because
Tom> gdbserver links against libiberty now, I think this is not needed.
Tom> This patch removes it.

Tom> gdb/gdbserver/ChangeLog
Tom> 2019-09-03  Tom Tromey  <tromey@adacore.com>

Tom> 	* utils.c (xstrdup): Remove.

I'm checking this in now.

Tom
  

Patch

diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 79a7e80f625..6a0e7a7a0f9 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -37,18 +37,6 @@  malloc_failure (long size)
   exit (1);
 }
 
-/* Copy a string into a memory buffer.
-   If malloc fails, this will print a message to stderr and exit.  */
-
-char *
-xstrdup (const char *s)
-{
-  char *ret = strdup (s);
-  if (ret == NULL)
-    malloc_failure (strlen (s) + 1);
-  return ret;
-}
-
 /* Print the system error message for errno, and also mention STRING
    as the file name for which the error was encountered.
    Then return to command level.  */