}
"\""[^\"]*"\"" {
- yylval.id = xstrdup (yytext+1);
- yylval.id[yyleng-2] = 0;
+ yylval.id = xmemdup (yytext + 1, yyleng - 2, yyleng - 1);
return ID;
}
"\'"[^\']*"\'" {
- yylval.id = xstrdup (yytext+1);
- yylval.id[yyleng-2] = 0;
+ yylval.id = xmemdup (yytext + 1, yyleng - 2, yyleng - 1);
return ID;
}
"*".* { }
static inline char *
xmemdup0 (const char *in, size_t len)
{
- char *out = (char *) xmalloc (len + 1);
- out[len] = 0;
- return (char *) memcpy (out, in, len);
+ return xmemdup (in, len, len + 1);
}
struct expressionS;
}
<SCRIPT,EXPRESSION,WILD,VERS_NODE,INPUTLIST>"\""[^\"]*"\"" {
- /* No matter the state, quotes
- give what's inside. */
- bfd_size_type len;
- yylval.name = xstrdup (yytext + 1);
- /* PR ld/20906. A corrupt input file
- can contain bogus strings. */
- len = strlen (yylval.name);
- if (len > (bfd_size_type) yyleng - 2)
- len = yyleng - 2;
- yylval.name[len] = 0;
- return NAME;
- }
+ /* No matter the state, quotes give what's inside. */
+ yylval.name = xmemdup (yytext + 1, yyleng - 2, yyleng - 1);
+ return NAME;
+ }
<SCRIPT,EXPRESSION,WILD,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>"\n" {
lineno++; }