summaryrefslogtreecommitdiff
path: root/xkbparse.y
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2010-06-08 15:11:19 +0100
committerDaniel Stone <daniel@fooishbar.org>2010-06-15 19:26:49 +0100
commit41b0857c8c1179b87a26888588cbfff28f8bb0d6 (patch)
tree19a906b75cfddd57c333920759e7bba4d98a4ee9 /xkbparse.y
parent7f7a57c75beb5e1dfb53351e490ef00a324b2727 (diff)
Don't malloc() and free() most scanned symbols
Use a constant buffer. Sigh. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkbparse.y')
-rw-r--r--xkbparse.y18
1 files changed, 9 insertions, 9 deletions
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;
}