This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: strcpy -> memcpy


On Tue, Jun 25, 2002 at 10:45:11PM +0300, Elias Athanasopoulos wrote:
> 2002-06-25  Elias Athanasopoulos  <eathan@otenet.gr>
> 
> 	* ecoff.c (get_tag): Replace strcpy with xstrdup.
> 	(ecoff_directive_def): Likewise.
> 	(ecoff_directive_tag): Likewise.
> 	* listing.c (file_info): Likewise.

Applied, with a tweak to ecoff.c copyright date.  Thanks!

> 	* hash.c (what): Replace strcpy with memcpy.

I applied this instead.  You're patching test code here, and a quick
look over gas/ didn't show an "error" function.

Index: gas/hash.c
===================================================================
RCS file: /cvs/src/src/gas/hash.c,v
retrieving revision 1.8
diff -u -p -r1.8 hash.c
--- gas/hash.c	19 Sep 2001 05:33:19 -0000	1.8
+++ gas/hash.c	26 Jun 2002 01:09:21 -0000
@@ -1,6 +1,6 @@
 /* hash.c -- gas hash table code
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -546,19 +546,9 @@ char *
 what (description)
      char *description;
 {
-  char *retval;
-  char *malloc ();
-
   printf ("   %s : ", description);
   gets (answer);
-  /* Will one day clean up answer here.  */
-  retval = malloc (strlen (answer) + 1);
-  if (!retval)
-    {
-      error ("room");
-    }
-  (void) strcpy (retval, answer);
-  return (retval);
+  return xstrdup (answer);
 }
 
 void


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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