From 41b0857c8c1179b87a26888588cbfff28f8bb0d6 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 8 Jun 2010 15:11:19 +0100 Subject: Don't malloc() and free() most scanned symbols Use a constant buffer. Sigh. Signed-off-by: Daniel Stone --- xkbparse.y | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xkbparse.y') diff --git a/xkbparse.y b/xkbparse.y index 8f9a073..862acd8 100644 --- a/xkbparse.y +++ b/xkbparse.y @@ -311,10 +311,10 @@ Decl : OptMergeMode VarDecl { if ($1==MergeAltForm) { yyerror("cannot use 'alternate' to include other maps"); - $$= &IncludeCreate(scanStr,MergeDefault)->common; + $$= &IncludeCreate(scanBuf,MergeDefault)->common; } else { - $$= &IncludeCreate(scanStr,$1)->common; + $$= &IncludeCreate(scanBuf,$1)->common; } } ; @@ -721,7 +721,7 @@ KeySymList : KeySymList COMMA KeySym { $$= CreateKeysymList($1); } ; -KeySym : IDENT { $$= scanStr; scanStr= NULL; } +KeySym : IDENT { $$= strdup(scanBuf); } | SECTION { $$= strdup("section"); } | Integer { @@ -744,21 +744,21 @@ Float : FLOAT { $$= scanInt; } Integer : INTEGER { $$= scanInt; } ; -KeyName : KEYNAME { $$= scanStr; scanStr= NULL; } +KeyName : KEYNAME { $$= strdup(scanBuf); } ; -Ident : IDENT { $$= XkbInternAtom(NULL,scanStr,False); } +Ident : IDENT { $$= XkbInternAtom(NULL,scanBuf,False); } | DEFAULT { $$= XkbInternAtom(NULL,"default",False); } ; -String : STRING { $$= XkbInternAtom(NULL,scanStr,False); } +String : STRING { $$= XkbInternAtom(NULL,scanBuf,False); } ; OptMapName : MapName { $$= $1; } | { $$= NULL; } ; -MapName : STRING { $$= scanStr; scanStr= NULL; } +MapName : STRING { $$= strdup(scanBuf); } ; %% void @@ -767,8 +767,8 @@ yyerror(const char *s) if (warningLevel>0) { (void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum, (scanFile?scanFile:"(unknown)")); - if ((scanStr)&&(warningLevel>3)) - (void)fprintf(stderr,"last scanned symbol is: %s\n",scanStr); + if ((warningLevel>3)) + (void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf); } return; } -- cgit v1.2.3