This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] strdup->xstrdup
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA] strdup->xstrdup
- From: Jeff Holcomb <jeffh at redhat dot com>
- Date: Wed, 24 Jan 2001 14:27:59 -0800 (PST)
More cleanup work.
2001-01-24 Jeff Holcomb <jeffh@redhat.com>
* remote-udi.c (udi_open): Change strdup to xstrdup.
* thread.c (thread_apply_all_command): Likewise.
* varobj.c (delete_variable_1): Likewise.
* config/xm-mpw.h: Remove declaration of strdup.
* config/i386/xm-i386mach.h: Likewise.
* config/m68k/xm-apollo68b.h: Likewise.
* config/m68k/xm-hp300bsd.h: Likewise.
* config/rs6000/xm-rs6000.h: Likewise.
* config/vax/xm-vaxult.h: Likewise.
* config/vax/xm-vaxult2.h: Likewise.
* gdb_string.h: Likewise.
Index: gdb_string.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb_string.h,v
retrieving revision 1.2
diff -u -p -r1.2 gdb_string.h
--- gdb_string.h 2000/05/28 01:12:27 1.2
+++ gdb_string.h 2001/01/24 22:22:42
@@ -58,10 +58,6 @@ extern char *strerror (int); /* X3.159-1
#endif
#endif
-#ifdef NEED_DECLARATION_STRDUP
-extern char *strdup (); /* full prototype collides w/ some OSes (AIX 3.2.5) */
-#endif
-
#ifdef NEED_DECLARATION_STRSTR
#ifndef strstr
extern char *strstr (const char *, const char *); /* X3.159-1989 4.11.5.7 */
Index: remote-udi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-udi.c,v
retrieving revision 1.9
diff -u -p -r1.9 remote-udi.c
--- remote-udi.c 2001/01/23 22:48:55 1.9
+++ remote-udi.c 2001/01/24 22:22:42
@@ -234,7 +234,7 @@ udi_open (char *name, int from_tty)
if (!name)
error ("Usage: target udi config_id, where config_id appears in udi_soc file");
- udi_config_id = strdup (strtok (name, " \t"));
+ udi_config_id = xstrdup (strtok (name, " \t"));
if (UDIConnect (udi_config_id, &udi_session_id))
/* FIXME: Should set udi_session_id to -1 here. */
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.9
diff -u -p -r1.9 thread.c
--- thread.c 2000/12/15 01:01:50 1.9
+++ thread.c 2001/01/24 22:22:42
@@ -531,7 +531,7 @@ thread_apply_all_command (char *cmd, int
/* Save a copy of the command in case it is clobbered by
execute_command */
- saved_cmd = strdup (cmd);
+ saved_cmd = xstrdup (cmd);
saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
for (tp = thread_list; tp; tp = tp->next)
if (thread_alive (tp))
@@ -574,7 +574,7 @@ thread_apply_command (char *tidlist, int
/* Save a copy of the command in case it is clobbered by
execute_command */
- saved_cmd = strdup (cmd);
+ saved_cmd = xstrdup (cmd);
saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
while (tidlist < cmd)
{
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.15
diff -u -p -r1.15 varobj.c
--- varobj.c 2001/01/19 05:45:16 1.15
+++ varobj.c 2001/01/24 22:22:43
@@ -1072,7 +1072,7 @@ delete_variable_1 (struct cpstack **resu
yet been installed, don't report it, it belongs to the caller... */
if (var->obj_name != NULL)
{
- cppush (resultp, strdup (var->obj_name));
+ cppush (resultp, xstrdup (var->obj_name));
*delcountp = *delcountp + 1;
}
Index: config/xm-mpw.h
===================================================================
RCS file: /cvs/src/src/gdb/config/xm-mpw.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xm-mpw.h
--- xm-mpw.h 1999/07/07 20:11:40 1.1.1.2
+++ xm-mpw.h 2001/01/24 22:22:43
@@ -42,10 +42,6 @@
#define POSIX_UTIME
-/* No declaration of strdup in MPW's string.h, oddly enough. */
-
-char *strdup (char *s1);
-
/* '.' indicates drivers on the Mac, so we need a different filename. */
#define GDBINIT_FILENAME "_gdbinit"
Index: config/i386/xm-i386mach.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/xm-i386mach.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xm-i386mach.h
--- xm-i386mach.h 1999/07/07 20:13:35 1.1.1.2
+++ xm-i386mach.h 2001/01/24 22:22:44
@@ -27,5 +27,3 @@
/* <errno.h> only defines this if __STDC__!!! */
extern int errno;
-
-extern char *strdup ();
Index: config/m68k/xm-apollo68b.h
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/xm-apollo68b.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xm-apollo68b.h
--- xm-apollo68b.h 1999/07/07 20:14:41 1.1.1.2
+++ xm-apollo68b.h 2001/01/24 22:22:44
@@ -21,5 +21,3 @@
#define HOST_BYTE_ORDER BIG_ENDIAN
#define ALIGN_STACK_ON_STARTUP
-
-extern char *strdup ();
Index: config/m68k/xm-hp300bsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/xm-hp300bsd.h,v
retrieving revision 1.2
diff -u -p -r1.2 xm-hp300bsd.h
--- xm-hp300bsd.h 2000/05/28 01:12:36 1.2
+++ xm-hp300bsd.h 2001/01/24 22:22:44
@@ -30,8 +30,6 @@
/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */
#define ONE_PROCESS_WRITETEXT
-
-extern char *strdup (const char *);
/* Interface definitions for kernel debugger KDB. */
Index: config/rs6000/xm-rs6000.h
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/xm-rs6000.h,v
retrieving revision 1.2
diff -u -p -r1.2 xm-rs6000.h
--- xm-rs6000.h 2000/05/28 01:12:39 1.2
+++ xm-rs6000.h 2001/01/24 22:22:45
@@ -67,9 +67,6 @@
#define SETPGRP_ARGS 1
-/* AIX doesn't have strdup, so we need to declare it for libiberty */
-extern char *strdup (char *);
-
/* Signal handler for SIGWINCH `window size changed'. */
#define SIGWINCH_HANDLER aix_resizewindow
Index: config/vax/xm-vaxult.h
===================================================================
RCS file: /cvs/src/src/gdb/config/vax/xm-vaxult.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xm-vaxult.h
--- xm-vaxult.h 1999/07/07 20:17:34 1.1.1.2
+++ xm-vaxult.h 2001/01/24 22:22:45
@@ -1,8 +1,6 @@
/* Definitions to make GDB run on a vax under Ultrix. */
#include "vax/xm-vax.h"
-extern char *strdup ();
-
/* This is required for Ultrix 3.1b, not for later versions. Ultrix
3.1b can't just use xm-vaxult2.h because Ultrix 3.1b does define
FD_SET. Sure, we could have separate configurations for vaxult2,
Index: config/vax/xm-vaxult2.h
===================================================================
RCS file: /cvs/src/src/gdb/config/vax/xm-vaxult2.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 xm-vaxult2.h
--- xm-vaxult2.h 1999/07/07 20:17:35 1.1.1.2
+++ xm-vaxult2.h 2001/01/24 22:22:45
@@ -1,8 +1,6 @@
/* Definitions to make GDB run on a vax under Ultrix. */
#include "vax/xm-vax.h"
-extern char *strdup ();
-
#define NO_PTRACE_H
/* Old versions of ultrix have fd_set but not the FD_* macros. */