diff options
author | Alan Modra <amodra@gmail.com> | 2005-02-22 12:57:27 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-02-22 12:57:27 +0000 |
commit | dc3c06c291951d9aca329aa6a69fc3443f08f0b1 (patch) | |
tree | 0cc8fa1cb3099e3e792d41eff523bbcbd7637477 /binutils/syslex.l | |
parent | 58e2ea4d1caa51d171a9a8fb8649a6cda59ad28e (diff) | |
download | gdb-dc3c06c291951d9aca329aa6a69fc3443f08f0b1.zip gdb-dc3c06c291951d9aca329aa6a69fc3443f08f0b1.tar.gz gdb-dc3c06c291951d9aca329aa6a69fc3443f08f0b1.tar.bz2 |
* Makefile.am (syslex.o, sysinfo.o): Pass AM_CFLAGS to compiler.
(syslex.o, sysinfo.o, dlltool.o, rescoff.o): Remove duplicate
dependencies. Run "make dep-am".
* nlmconv.c: Warning fixes.
* readelf.c: Likewise.
* srconv.c: Likewise.
* sysdump.c: Likewise.
* sysinfo.y: Likewise.
* syslex.l: Likewise. Use yyleng instead of strlen, memcpy instead
of strcpy.
* Makefile.in: Regenerate.
Diffstat (limited to 'binutils/syslex.l')
-rw-r--r-- | binutils/syslex.l | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/binutils/syslex.l b/binutils/syslex.l index ffaf4fa..6dd32fa 100644 --- a/binutils/syslex.l +++ b/binutils/syslex.l @@ -1,5 +1,5 @@ %{ -/* Copyright 2001, 2003 Free Software Foundation, Inc. +/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -18,14 +18,26 @@ along with GLD; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" +#ifdef HAVE_STRING_H +#include <string.h> +#else +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif +#endif #include "sysinfo.h" char *word; int number; int unit; +#define YY_NO_UNPUT + #ifndef yywrap static int yywrap (void) { return 1; } #endif + +extern int yylex (void); %} %% "(" { return '(';} @@ -37,9 +49,9 @@ static int yywrap (void) { return 1; } "\t" { ; } "\n" { ; } "\""[^\"]*"\"" { -yylval.s = malloc(strlen (yytext)); -strcpy(yylval.s, yytext+1); -yylval.s[strlen(yylval.s)-1] = 0; + yylval.s = malloc (yyleng - 1); + memcpy (yylval.s, yytext + 1, yyleng - 2); + yylval.s[yyleng - 2] = '\0'; return NAME; } |