summaryrefslogtreecommitdiff
path: root/binutils/syslex.l
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-02-22 12:57:27 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-02-22 12:57:27 +0000
commit0fa07a9d775852c070113ccb1f27da3e14ae3cf5 (patch)
tree1176e8e57a22ed19a81abc9ce4896b1a1f3c2ab6 /binutils/syslex.l
parente9a32c3d0ccc2ceee814eca1c5ee07c4c1289fe5 (diff)
downloadbinutils-redhat-0fa07a9d775852c070113ccb1f27da3e14ae3cf5.tar.gz
* 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.l20
1 files changed, 16 insertions, 4 deletions
diff --git a/binutils/syslex.l b/binutils/syslex.l
index ffaf4fad2d..6dd32fad37 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;
}