aboutsummaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-01-13 10:46:45 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-01-13 10:46:45 +0000
commitefd59a3308bc1ad7dd1527d9e6fa1feaa0a87f56 (patch)
treebf643739547223da4478feeee08ef27e41880c22 /gcc/collect2.c
parent9684789222a5e8e34eac4565cd42f4e848a942fc (diff)
downloadgcc-efd59a3308bc1ad7dd1527d9e6fa1feaa0a87f56.zip
gcc-efd59a3308bc1ad7dd1527d9e6fa1feaa0a87f56.tar.gz
gcc-efd59a3308bc1ad7dd1527d9e6fa1feaa0a87f56.tar.bz2
cccp.c (xstrdup): Renamed from `savestring'.
* cccp.c (xstrdup): Renamed from `savestring'. All callers changed. Remove prototype which we get from libiberty.h. * collect2.c (xstrdup): Likewise. * genextract.c (xstrdup): Likewise for `copystr'. (mybzero): Remove it and use `memset' instead. * genoutput.c (mybcopy, mybzero): Remove these. All callers changed to use `memcpy' and `memset' instead. * genrecog.c (xstrdup): Renamed from `copystr'. All callers changed. Remove prototype. (mybcopy, mybzero): Remove these and use memcpy/memset. From-SVN: r24650
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 8da2846..2184e0e 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1,6 +1,6 @@
/* Collect static initialization info into data structures that can be
traversed by C++ initialization and finalization routines.
- Copyright (C) 1992, 93-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc.
Contributed by Chris Smith (csmith@convex.com).
Heavily modified by Michael Meissner (meissner@cygnus.com),
Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com).
@@ -551,13 +551,12 @@ file_exists (name)
/* Make a copy of a string INPUT with size SIZE. */
char *
-savestring (input, size)
- char *input;
- int size;
+xstrdup (input)
+ const char *input;
{
- char *output = (char *) xmalloc (size + 1);
- bcopy (input, output, size);
- output[size] = 0;
+ register size_t len = strlen (input) + 1;
+ register char *output = xmalloc (len);
+ memcpy (output, input, len);
return output;
}
@@ -874,7 +873,7 @@ add_prefix (pprefix, prefix)
pprefix->max_len = len;
pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
- pl->prefix = savestring (prefix, len);
+ pl->prefix = xstrdup (prefix);
if (*prev)
pl->next = *prev;