* 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-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.
#include "ldgram.h"
#include "ldlex.h"
#include "ldemul.h"
+#include "libiberty.h"
#include <ctype.h>
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));
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;
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
#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. */
<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])+ {
<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}* {
}
else
{
- yylval.name = buystring(yytext);
+ yylval.name = xstrdup(yytext);
return NAME;
}
}
<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;
}
<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; }
error_count = 0;
if (error_name != (char *) NULL)
free (error_name);
- error_name = buystring (name);
+ error_name = xstrdup (name);
}
if (section != NULL)
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)
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
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)
/* 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);
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;
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;
}