src/compose


Log

Author Commit Date CI Message
Ran Benita 7e6d942a 2021-04-02T15:00:46 compose: fix max compose nodes check Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 02b9cabf 2021-03-29T16:05:14 compose: use a ternary tree instead of a regular trie Previously we used a simple trie with a linked list for each chain. Unfortunately most compose files have very long chains which means the constructions performs an almost quadratic number of comparisons. Switch to using a ternary search tree instead. This is very similar to a trie, only the linked list is essentially replaced with a binary tree. On the en_US/Compose file, the perf diff is the following (the modified function is `parse`): Event 'cycles:u' Baseline Delta Abs Shared Object Symbol ........ ......... ................ ................................. 39.91% -17.62% bench-compose [.] parse.constprop.0 20.54% +6.47% bench-compose [.] lex 17.28% +5.55% libc-2.33.so [.] __strcmp_avx2 12.78% +4.01% bench-compose [.] xkb_keysym_from_name 2.30% +0.83% libc-2.33.so [.] __GI_____strtoull_l_internal 3.36% +0.78% bench-compose [.] strcmp@plt Thanks to some careful packing, the memory usage is pretty much the same. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 8b09e177 2021-03-30T20:12:08 compose: use anonymous union Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 1638409b 2021-03-30T17:52:36 compose: add a limit of 65535 sequences Fits in uint16_t, which enables some future optimizations. But also a good idea to have some limit. Not aware of any compose files which come close. Signed-off-by: Ran Benita <ran@unusedvar.com>
Emmanuel Gil Peyrot ddd1188d 2020-07-17T01:09:47 Make path retrieval consistent in xkb_compose_table_new_from_locale()
Emmanuel Gil Peyrot 17ad0df1 2020-07-16T12:06:49 compose: add xdg base directory support Before reading ~/.XCompose, try to read $XDG_CONFIG_HOME/XCompose (falling back to ~/.config/XCompose). This helps unclutter the home directory of users who want that.
Peter Hutterer 41a7c975 2020-07-10T14:57:57 Add asprintf_safe helper function We only ever care about whether we error out or not, so let's wrap this into something more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita da4a90c1 2019-12-28T13:49:40 Open files in binary mode This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 40aab05e 2019-12-27T13:03:20 build: include config.h manually Previously we included it with an `-include` compiler directive. But that's not portable. And it's better to be explicit anyway. Every .c file should have `include "config.h"` first thing. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 406beeca 2019-11-12T22:06:02 Replace some tabs that sneaked in with spaces Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 842e4351 2018-03-12T09:43:55 compose: fix infinite loop in parser on some inputs The parser would enter an infinite loop if an unterminated keysym literal occurs at EOF. Found with the afl fuzzer. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 47f45194 2017-12-12T15:44:52 compose/parser: be more careful when checking if sequence overrides or duplicates another Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone ce38f96e 2017-04-11T15:09:23 Add explicit fallthrough case statements When we fall through to another label in a case, add an explicit comment noting so, to quiet GCC 7's warnings. Signed-off-by: Daniel Stone <daniels@collabora.com>
Ran Benita 1ec14d09 2016-12-02T22:46:53 compose: remove the keysym_from_name cache The hit rate is high, but either the cache is slow or the function is not fast enough -- the cache no longer holds its weight, leading only to very modest improvements. If it's the former, it can definitely be improved, the code is very dumb (though it worked just as well as any other I tried back then). But instead, let's just kill it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2cca0289 2015-11-19T00:44:27 src/utils: change map_file to not take const string argument map_file() uses PROT_READ, so const seems fitting; however unmap_file calls munmap/free, which do not take const, so an UNCONSTIFY is needed. To avoid the UNCONSTIFY hack, which is likely undefined behavior or some such, just remove the const. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8e1fed6c 2015-03-24T16:40:29 compose: correctly parse modifier syntax As described in: http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=ddf3b09bb262d01b56fbaade421ac85b0e60a69f Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c03834a1 2014-10-23T21:00:20 Reduce variable scopes Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f774f819 2014-10-18T13:23:53 Replace some strncmp's with memcmp Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a4cc119b 2014-10-18T12:36:40 compose/parser: save len in keysym_from_name cache This reduces a lot of strcmp's, and allows to use a faster memcmp. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c6e63fd7 2014-10-14T11:28:17 compose/parser: fix parsing of multiple modifiers Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d1c5dd14 2014-10-13T18:19:16 compose/parser: parse (! mods) properly We don't actually do anything with them. But if someone uses them we can at least not choke. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3c0c3afa 2014-10-13T15:47:13 compose/parser: resolve keysyms in parser instead of scanner It will become context-sensitive. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0b99c63c 2014-10-13T15:05:48 compose/parser: use parameter as intended Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8bba4b34 2014-10-13T00:16:59 compose/parser: one more skip_to_eol() Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a3116f97 2014-10-13T18:51:12 compose/parser: fix segfault when including The keysym cache for the new scanner was not initialized. To avoid such errors also in the future, require passing the priv argument in scanner_init(), instead of initializing it separately. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 65c355aa 2014-10-13T14:28:27 COPYING: add copyright notice from libX11:modules/im/ximcp/imLcPrs.c We have used some portions of it, so add the notice. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8a0acf2c 2014-10-07T23:42:08 scanner-utils: optimize one-line comments Compose files have a lot of those. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita edc98b54 2014-09-12T18:44:30 compose: add xkbcommon-compose - implementation Signed-off-by: Ran Benita <ran234@gmail.com>