Commit Graph

236 Commits (19e99bb27a8ab4121aa28124db4d26ba6de73f47)

Author SHA1 Message Date
Ran Benita 19e99bb27a Free all atoms along with keymap
The code to do this is taken from xserver, dix/atom.c.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita d94d9b4522 Free IncludePath when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 1e6f956e36 Free scanFile when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita e4447f8131 Fix other misc leaks
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 30d88b93e7 Don't leak the scanner's buffer
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c24d97e45e Don't leak DoodadInfo's from GeometryInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c800c60ace Don't leak ActionInfo's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita d67e73bdbd Don't leak KeyNamesInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 5c40bee62a Don't leak the "minimum"/"maximum" string
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c50c87bca2 Don't leak the various *Info's names when overriding them
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 889a299e3b Free XkbFile's when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c357a11aa6 Add function to free XkbFile's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 3216ecc07f Don't cache loaded rules files
This needlessly occupies memory for the lifetime of the library, and
does not make a noticeable difference otherwise.

This rules file won't be loaded more than once in most cases anyway, so
just load it again when it happens.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:02:14 +02:00
Ran Benita ca9829ea66 Don't cache parsed files
This needlessly occupies memory for the lifetime of the library, and
does not make a noticeable difference otherwise.

Instead, just parse the same file again when it happens.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 23:59:43 +02:00
Ran Benita a64e970809 Remove unneeded freeing mechanisms
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita c7bf368780 Make the sections array local to the keymap compiling function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita baf6a677dc Remove unused global type tokens
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita f549ce078f Use global tables for action string handling
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita d2c3dd0c21 Constify some more text functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita eb738b13ce Constify global tables
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita a0b442356c Use limits.h to find min/max short value
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 266dfae589 Remove useless casts
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 1616b8642c Use strchr instead of index
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 4bc839ab89 Use memset instead of bzero
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita a3e40917ee Remove return's at the end of void functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita f278cea107 Remove all uses of the register keyword
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita f424251244 Use strdup instead of strlen + malloc + strcpy
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita 6a34e4e19a Don't check for NULL before free()
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita c41061a005 Use yacc-generated header instead of tokens.h
The yacc implementation can generate all the necessary token
definitions itself; there is no need to maintain a hand written
file for that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:45:29 +02:00
Ran Benita 0d8874d01c makekeys: update to match the rest of libX11 makekeys
This integrates two commits from libX11:

ebd6ef0a4db0ddef0ae17ad14571518ccdeea5ba
   XStringToKeysym: Special case for XF86 keysyms

    Some XFree86 keysyms were in XKeysymDB as XF86_foo, despite really being
    XF86foo.  So, if we get to the bottom of XStringToKeysym and haven't
    found our XF86_foo, try it again as XF86foo.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

00175397480b76d32bf82b0c7c94c91a2a95954e
    makekeys: Scan vendor keysyms as well as core

    Since we can't really live without vendor keysyms, scan them all in to
    generate ks_tables.h, rather than only doing the core ones, and leaving
    the vendor syms to be manually synchronised with XKeysymDB.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

Notice that the xkey.sh test is changed to match libX11 behavior, i.e.
XKeysymToString(0x1008FE20) -> "XF86Ungrab" as opposed to "XF86_Ungrab".

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:09:37 +02:00
Ran Benita ad4f195eb4 makekeys: Receive the keysym files as arguments
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:09:37 +02:00
Ran Benita 04e687c9da makekeys: Fix build/target word size mismatch when cross-compiling
This matches commit 24283d40b1e4314c6647dda49d2a159833341a8b from
libX11:

    Since makekeys is built using build environment's compiler and
    runs natively, we have to make sure that the size of the
    Signature type is the same on both the native environment
    and the target, otherwise we get mismatches upon running X,
    and some LSB test failures (xts5).

    Use an unsigned 32-bit integer on all platforms.

    Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
    Reviewed-by: Daniel Stone <daniel@fooishbar.org>

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:08:55 +02:00
Ran Benita 744527e9a9 Fix remaining warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita eff72fab5d Fix warnings in scanner and parser
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita 1d969c5cf6 Fix an incorrect sizeof
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita f3e4335fc6 Fix all constness warnings
These are all trivial/obvious fixes which clear a bunch of warnings.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita cca1c05097 Fix possible null dereferences
Fix all reported null dereferences from clang-analyzer.
There seems to be one false negative (in file indicators.c), but it is
fixed anyway.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita 9005624f94 Remove unneeded assignments and variables
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:59:56 +02:00
Ran Benita a0dd052644 Remove unused includes of "tokens.h"
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:59:56 +02:00
Ran Benita 9ad0be3358 Remove unused debug #defines
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:11:10 +02:00
Daniel Stone 1ab058bbb3 Fix typo in ExprResolveKeyCode
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:47:46 +00:00
Daniel Stone e209fe31df Perform bounds checking in ExprResolveGroup
Every caller did the exact same check on the group bounds after calling
ExprResolveGroup, so might as well do it inside.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:33:39 +00:00
Daniel Stone 43ed3ff070 Switch expression resolution priv from char to void
Avoids a lot of really lame casts.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:14:04 +00:00
Daniel Stone eb6d9a0528 Remove chaining support from LookupModMask
Turns out we never use it, so.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:09:06 +00:00
Daniel Stone 11ea079175 Invert LookupModMask/LookupVModMask order
We never want to solely lookup a virtual modifier without also looking
up core modifiers.  So, rather than chaining the vmod lookup inside the
core modifier lookup, invert the ordering.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:07:48 +00:00
Daniel Stone 1a2f2556dd Remove unused LookupPriv::priv
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:00:51 +00:00
Daniel Stone 55e058f856 Move some definitions from expr.h to expr.c
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:59:51 +00:00
Daniel Stone 90d86c360a Remove field reference lookup support
None of the lookup functions anyone ever used supported field
references, so don't pretend we do in the API.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:54:54 +00:00
Daniel Stone 590df28cc5 Move groupNames mask definition to its user
groupNames was declared in compat.c as a global to anything which
included compat.h (for which groupNames was its sole reason to exist),
but only ever used in indicators.c.

Which is kind of fortunate, given that e314931e removed identical
definitions of groupNames (as integers, not masks) from both action.c
and symbols.c.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:35:39 +00:00
Daniel Stone 91b8985297 Turn ExprResolveInteger into a simple wrapper
Move the bulk of ExprResolveInteger into an internal function called
ExprResolveIntegerLookup, and introduce ExprResolveInteger as a simple
wrapper which doesn't take priv/lookup arguments.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:24:02 +00:00