parse: remove unused #define

Signed-off-by: Ran Benita <ran234@gmail.com>
keycodes: fix valgrind warnings

==7071== Conditional jump or move depends on uninitialised value(s)
==7071==    at 0x40B6CB: AddIndicatorName (keycodes.c:148)
==7071==    by 0x40C34F: MergeIncludedKeycodes (keycodes.c:420)
==7071==    by 0x40C613: HandleIncludeKeycodes (keycodes.c:480)
==7071==    by 0x40D022: HandleKeycodesFile (keycodes.c:733)
==7071==    by 0x40D79F: CompileKeycodes (keycodes.c:881)
==7071==    by 0x401E22: compile_keymap (xkbcomp.c:157)
==7071==    by 0x402091: xkb_map_new_from_kccgst (xkbcomp.c:229)
==7071==    by 0x40216A: xkb_map_new_from_names (xkbcomp.c:254)
==7071==    by 0x4046F5: test_compile_rules (common.c:164)
==7071==    by 0x4015C1: test_rmlvo (rulescomp.c:44)
==7071==    by 0x40180D: main (rulescomp.c:98)

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: don't divide by zero

Calculator parser 101.

Signed-off-by: Ran Benita <ran234@gmail.com>
types: fix canonical types copying

Without the re-initialization, the copying fails. This wasn't noticed
because this code practically never gets executed with ordinary keymaps.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: Remove ExprResolveFloat

Remnant from geometry.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveKeyName

Explicit is better than implicit, and this useless union. The other
functions will follow.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveLhs

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveString

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveBoolean

Signed-off-by: Ran Benita <ran234@gmail.com>
atom: add and use xkb_atom_steal

We often get a strdup'd string, just to pass it over the atom_intern and
then immediately free it. But atom_intern then strdup's it again (if
it's not interned already). So this is just a small optimization hint.

Signed-off-by: Ran Benita <ran234@gmail.com>
Don't use xkb_atom_strdup when a constant string will do

Turns out, every time we strdup an atom, we don't actually modify it
afterwards. Since we are guaranteed that the atom table will live as
long as the context, we can just use xkb_atom_text instead. This
removes a large amount of dynamic allocations. xkb_atom_strdup is left
unused, as it may still be useful.

Signed-off-by: Ran Benita <ran234@gmail.com>
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. Lots of allocations gone.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove alloc.{c,h}

These functions are more appropriate elsewhere now.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveKeysym

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveGroup

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveKeyCode

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveLevel

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: drop ExprResult from ResolveButton

Signed-off-by: Ran Benita <ran234@gmail.com>