scanner: don't strdup key names
authorRan Benita <ran234@gmail.com>
Mon, 23 Jul 2012 14:41:55 +0000 (17:41 +0300)
committerRan Benita <ran234@gmail.com>
Thu, 26 Jul 2012 21:01:57 +0000 (00:01 +0300)
commit13eb9c357d6472b30b24e51efa93ee5c53d45d51
tree2633395fc663ce03cd5ce2206fb49c5abd64cd15
parent112cccb18ad1bc877b3c4a87fa536ea085c761b5
scanner: don't strdup key names

The key name is always XkbKeyNameLength (= 4) bytes, so we can maintain
it directly in YYSTYPE union and copy when needed, instead of treating
it like a full blown string and then copy. This means the scanner
checks the length itself.

rulescomp under valgrind, before:
==1038==   total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated
after:
==9377==   total heap usage: 155,643 allocs, 155,643 frees, 9,672,788 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/parser.y
src/xkbcomp/parseutils.c
src/xkbcomp/parseutils.h
src/xkbcomp/scanner.l