The two files do exactly the same sort of things, without any discernible
reason for splitting them.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_desc -> xkb_keymap changes.]
'Cause defining your own True and False is so 1990's.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Fixed for xkb_desc -> xkb_keymap changes.]
Since the most common failure mode here is a failure to properly set the
XKB data path, dump the include path so people at least have a clue
where to look.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
POSIX specifies that these functions require <strings.h>, but we were
only including <string.h>. It did work, but still.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
pure C file per test. All of the .sh files are removed, but everything
that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
"parallel-test" mechanism. This will create a single log file for each
test with it's stdout+stderr, and a top level "test-suite.log" file
for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
That way we can just put the directory in EXTRA_DIST and forget about
it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
for a completely non-recursive build.
Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.
It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_keymap changes.]
This is very useful because it avoids redundent pointers in structs
and/or parameter passing in the application.
Signed-off-by: Ran Benita <ran234@gmail.com>
The definitions in config.h should be available in all files an
implementation detail; it can be included through the build system
instead of having each file pull it every time.
This is especially helpful with AC_USE_SYSTEM_EXTENSIONS, as _GNU_SOURCE
and friends can have an effect by merely being defined, which can lead
to some confusion if its effective for only half the files.
And we don't really support a build _without_ config.h; so, one less
thing to worry about.
Signed-off-by: Ran Benita <ran234@gmail.com>
These are no longer needed for using the library, only building it. Most
users would still want xproto though, for the keysym definitions.
Signed-off-by: Ran Benita <ran234@gmail.com>
The kbproto header is already not needed here anymore.
Move the _X_EXPORT's to the corresponding function definitions, and use
straight extern "C" clauses instead of _XFUNCPROTOBEGIN/END.
It also makes more sense to have the EXPORT's in the source files, as it
provides some documentation to the reader, whereas in the header it's
obvious.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_keymap changes.]
xkb_state_ref was missing.
Also modify the _ref functions to return the object instead of being
void. This is a useful idiom:
struct my_object my_object_new(struct xkb_state *state)
{
[...]
my_object->state = xkb_state_ref(state);
[...]
}
Essentially "taking" a reference, such that you don't forget to
increment it and it's one line less (see example in our own code).
A case could also be made for _unref to return the object or NULL, but
this is quite uncommon.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_keymap changes.]
When merging group info from two KeyInfo's, the new size of the keysym
array was off. Fix it to match how it is used a few lines below.
There are also some peripheral fixes, and some comments (took me a
few minutes to get what's going on).
Signed-off-by: Ran Benita <ran234@gmail.com>
(They were not reported, see next commit).
The reset function declaration didn't match its name in the definition;
the _defaults variant matches better with the rest.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated to current master.]
Since we never return an xkb_rules_names and it's all user-provided
strings, seems a bit harsh to have it const.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
autotools was warning that AC_USE_SYSTEM_EXTENSIONS was being called too
late, so move it earlier. Also shove BASE_CFLAGS into CFLAGS so we get
all the added warning flags from xorg.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Various one-liners (mostly removing unused variables) to make the code
safe for the full set of warnings used by the xorg macros.
On Debian-based systems, flex generates incorrect code resulting in two
warnings about yy_getcolumn and yy_setcolumn having no previous
declaration despite being non-static. Fedora carries a patch to fix
this, and a bug has been filed on Debian's flex to add the patch:
http://bugs.debian.org/667027
Aside from this, it's now safe for --enable-strict-compilation.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
If a keysym was specified as "U1039andsomeextrastuffontheend", return
NoSymbol rather than 0x10001039; similarly, return NoSymbol for
"0xdeadbeefhitherehowsyourdaybeen" rather than 0xdeadbeef.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This change makes sure that include does not overwrite previous
compatibility modifier settings when the included files does not
explicitly specify them.
Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
[Cross-picked from xkbcomp commit 14470719.]
When xkb_free_keymap is called the atoms are all free'd, but action.c
keeps a global copy of interned "true" and "false", which remains stale.
The correct fix is to remove the need for the ActionsInit function
entirely.
Signed-off-by: Ran Benita <ran234@gmail.com>
These were several initializations that were forgotten in the previous
memory leak fixes.
Now several xkb_desc's can coexist (relatively) peacefully.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Only the atom.c is relevant with the new context API.]
The "makeit" variable is always true. Remove it and de-indent.
(Also change the type of the "len" variable to size_t to avoid some
useless casting).
Signed-off-by: Ran Benita <ran234@gmail.com>
The NULL check is unneeded, and prevented the atoms from being free'd.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_map_unref.]
The new glibc (2.15) appear to cause trouble, particularly the sscanf
call, where makekeys will output empty hash tables. Using the appropriate
macros from inttypes.h makes it work again.
Signed-off-by: Ran Benita <ran234@gmail.com>
Such as:
Compiling path: ./test/data/bad.xkb mapName:
==1300== Conditional jump or move depends on uninitialised value(s)
==1300== at 0x4E46166: HandleVModDef (vmod.c:90)
==1300== by 0x4E3FEC9: HandleKeyTypesFile (keytypes.c:1035)
==1300== by 0x4E3FBE1: HandleIncludeKeyTypes.constprop.11 (keytypes.c:387)
==1300== by 0x4E401DD: HandleKeyTypesFile (keytypes.c:1022)
==1300== by 0x4E3FBE1: HandleIncludeKeyTypes.constprop.11 (keytypes.c:387)
==1300== by 0x4E401DD: HandleKeyTypesFile (keytypes.c:1022)
==1300== by 0x4E4026F: CompileKeyTypes (keytypes.c:1150)
==1300== by 0x4E3DF9B: CompileKeymap (keymap.c:169)
==1300== by 0x4E465E9: compile_keymap (xkbcomp.c:205)
==1300== by 0x4E46BE4: xkb_compile_keymap_from_file (xkbcomp.c:290)
==1300== by 0x400B37: test_file (filecomp.c:47)
==1300== by 0x4008E3: main (filecomp.c:90)
==1300== Uninitialised value was created by a stack allocation
==1300== at 0x4E3FB3F: HandleIncludeKeyTypes.constprop.11 (keytypes.c:366)
Signed-off-by: Ran Benita <ran234@gmail.com>
If we can't find the component of the include file we're looking for,
make sure we don't return success when we meant failure, segfault, or
spectacularly leak everything.
Tested with incorrect component includes for keycodes, compat, symbols,
and types.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: David Herrmann <dh.herrmann@googlemail.com>