aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-05-02 16:42:55 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-05-02 16:42:55 +0000
commitd1b2b2dcb9990cc1b113ce35fe9ebe120d34b1c3 (patch)
tree1b9443e600a2baea4f6e474bbbf51aa384bb04fb /ld
parent5cb1517bba5802b8b14e2ed42cffdaee788704df (diff)
downloadgdb-d1b2b2dcb9990cc1b113ce35fe9ebe120d34b1c3.zip
gdb-d1b2b2dcb9990cc1b113ce35fe9ebe120d34b1c3.tar.gz
gdb-d1b2b2dcb9990cc1b113ce35fe9ebe120d34b1c3.tar.bz2
2001-05-02 H.J. Lu <hjl@gnu.org>
* ldfile.c: Include "libiberty.h". * ldlex.l: Likewise. * ldmisc.c (buystring): Removed. * ldmisc.h: Likewise. * ldfile.c: Replace buystring with xstrdup. * ldlang.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * lexsup.c: Likewise. * mpw-eppcmac.c: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog16
-rw-r--r--ld/ldfile.c3
-rw-r--r--ld/ldlang.c4
-rw-r--r--ld/ldlex.l17
-rw-r--r--ld/ldmain.c2
-rw-r--r--ld/ldmisc.c14
-rw-r--r--ld/ldmisc.h1
-rw-r--r--ld/lexsup.c4
-rw-r--r--ld/mpw-eppcmac.c2
9 files changed, 35 insertions, 28 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index affbc1e..2c366a9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,19 @@
+2001-05-02 H.J. Lu <hjl@gnu.org>
+
+ * ldfile.c: Include "libiberty.h".
+ * ldlex.l: Likewise.
+
+ * ldmisc.c (buystring): Removed.
+ * ldmisc.h: Likewise.
+
+ * ldfile.c: Replace buystring with xstrdup.
+ * ldlang.c: Likewise.
+ * ldlex.l: Likewise.
+ * ldmain.c: Likewise.
+ * ldmisc.c: Likewise.
+ * lexsup.c: Likewise.
+ * mpw-eppcmac.c: Likewise.
+
2001-04-30 Andreas Jaeger <aj@suse.de>
* emulparms/elf_x86_64.sh (MAXPAGESIZE): Fix value.
diff --git a/ld/ldfile.c b/ld/ldfile.c
index e8122fe..0e4d0ec 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -33,6 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ldgram.h"
#include "ldlex.h"
#include "ldemul.h"
+#include "libiberty.h"
#include <ctype.h>
@@ -414,7 +415,7 @@ void
ldfile_add_arch (in_name)
CONST char *in_name;
{
- char *name = buystring (in_name);
+ char *name = xstrdup (in_name);
search_arch_type *new =
(search_arch_type *) xmalloc (sizeof (search_arch_type));
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 21e540e..a89fcf6 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -623,7 +623,7 @@ lang_memory_region_lookup (name)
lang_memory_region_type *new =
(lang_memory_region_type *) stat_alloc (sizeof (lang_memory_region_type));
- new->name = buystring (name);
+ new->name = xstrdup (name);
new->next = (lang_memory_region_type *) NULL;
*lang_memory_region_list_tail = new;
@@ -1994,7 +1994,7 @@ ldlang_add_undef (name)
new->next = ldlang_undef_chain_list_head;
ldlang_undef_chain_list_head = new;
- new->name = buystring (name);
+ new->name = xstrdup (name);
}
/* Run through the list of undefineds created above and place them
diff --git a/ld/ldlex.l b/ld/ldlex.l
index e0a50af..eecb902 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -45,6 +45,7 @@ This was written by steve chamberlain
#include "ldfile.h"
#include "ldlex.h"
#include "ldmain.h"
+#include "libiberty.h"
/* The type of top-level parser input.
yylex and yyparse (indirectly) both check this. */
@@ -147,7 +148,7 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
<DEFSYMEXP>"-" { RTOKEN('-');}
<DEFSYMEXP>"+" { RTOKEN('+');}
-<DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = buystring(yytext); return NAME; }
+<DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = xstrdup(yytext); return NAME; }
<DEFSYMEXP>"=" { RTOKEN('='); }
<MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
@@ -333,17 +334,17 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
<MRI>{FILENAMECHAR1}{NOCFILENAMECHAR}* {
/* Filename without commas, needed to parse mri stuff */
- yylval.name = buystring(yytext);
+ yylval.name = xstrdup(yytext);
return NAME;
}
<BOTH,EXPRESSION>{FILENAMECHAR1}{FILENAMECHAR}* {
- yylval.name = buystring(yytext);
+ yylval.name = xstrdup(yytext);
return NAME;
}
<BOTH,EXPRESSION>"-l"{FILENAMECHAR}+ {
- yylval.name = buystring (yytext + 2);
+ yylval.name = xstrdup (yytext + 2);
return LNAME;
}
<SCRIPT>{WILDCHAR}* {
@@ -358,7 +359,7 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
}
else
{
- yylval.name = buystring(yytext);
+ yylval.name = xstrdup(yytext);
return NAME;
}
}
@@ -366,7 +367,7 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
<EXPRESSION,BOTH,SCRIPT,VERS_NODE>"\""[^\"]*"\"" {
/* No matter the state, quotes
give what's inside */
- yylval.name = buystring(yytext+1);
+ yylval.name = xstrdup(yytext+1);
yylval.name[yyleng-2] = 0;
return NAME;
}
@@ -381,10 +382,10 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
<VERS_NODE>extern { RTOKEN(EXTERN); }
-<VERS_NODE>{V_IDENTIFIER} { yylval.name = buystring (yytext);
+<VERS_NODE>{V_IDENTIFIER} { yylval.name = xstrdup (yytext);
return VERS_IDENTIFIER; }
-<VERS_SCRIPT>{V_TAG} { yylval.name = buystring (yytext);
+<VERS_SCRIPT>{V_TAG} { yylval.name = xstrdup (yytext);
return VERS_TAG; }
<VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 4e9827f..8a170a7 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -1205,7 +1205,7 @@ undefined_symbol (info, name, abfd, section, address, fatal)
error_count = 0;
if (error_name != (char *) NULL)
free (error_name);
- error_name = buystring (name);
+ error_name = xstrdup (name);
}
if (section != NULL)
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index a27cf11..397442e 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -335,10 +335,10 @@ vfinfo (fp, fmt, arg)
last_bfd = abfd;
if (last_file != NULL)
free (last_file);
- last_file = buystring (filename);
+ last_file = xstrdup (filename);
if (last_function != NULL)
free (last_function);
- last_function = buystring (functionname);
+ last_function = xstrdup (functionname);
}
discard_last = false;
if (linenumber != 0)
@@ -467,16 +467,6 @@ info_assert (file, line)
einfo (_("%F%P: internal error %s %d\n"), file, line);
}
-char *
-buystring (x)
- CONST char *CONST x;
-{
- size_t l = strlen (x) + 1;
- char *r = xmalloc (l);
- memcpy (r, x, l);
- return r;
-}
-
/* ('m' for map) Format info message and print on map. */
void
diff --git a/ld/ldmisc.h b/ld/ldmisc.h
index fd0f19c..998fb4f 100644
--- a/ld/ldmisc.h
+++ b/ld/ldmisc.h
@@ -42,7 +42,6 @@ extern void yyerror PARAMS ((const char *));
extern PTR xmalloc PARAMS ((size_t));
extern PTR xrealloc PARAMS ((PTR, size_t));
extern void xexit PARAMS ((int));
-extern char *buystring PARAMS ((CONST char *CONST));
#define ASSERT(x) \
do { if (!(x)) info_assert(__FILE__,__LINE__); } while (0)
diff --git a/ld/lexsup.c b/ld/lexsup.c
index fb2e3f5..30e1665 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -816,7 +816,7 @@ parse_args (argc, argv)
/* Fall through. */
case OPTION_RPATH:
if (command_line.rpath == NULL)
- command_line.rpath = buystring (optarg);
+ command_line.rpath = xstrdup (optarg);
else
{
size_t rpath_len = strlen (command_line.rpath);
@@ -853,7 +853,7 @@ parse_args (argc, argv)
break;
case OPTION_RPATH_LINK:
if (command_line.rpath_link == NULL)
- command_line.rpath_link = buystring (optarg);
+ command_line.rpath_link = xstrdup (optarg);
else
{
char *buf;
diff --git a/ld/mpw-eppcmac.c b/ld/mpw-eppcmac.c
index 204a6eb..0cd70fb 100644
--- a/ld/mpw-eppcmac.c
+++ b/ld/mpw-eppcmac.c
@@ -843,7 +843,7 @@ gldppcmacos_read_file (filename, import)
n = ((struct export_symbol_list *)
xmalloc (sizeof (struct export_symbol_list)));
n->next = export_symbols;
- n->name = buystring (symname);
+ n->name = xstrdup (symname);
n->syscall = syscall;
export_symbols = n;
}