|
3aaa4e2a
|
2023-10-30T15:51:34
|
|
rules: early detection of invalid encoding
|
|
9e887180
|
2023-10-29T07:44:39
|
|
rules: skip heading UTF-8 encoded BOM (U+FEFF)
Leading BOM is legal and is used as a signature — an indication that
an otherwise unmarked text file is in UTF-8.
See: https://www.unicode.org/faq/utf_bom.html#bom5 for further details.
|
|
c0065c95
|
2023-09-21T20:06:27
|
|
Messages: merge macros with and without message code
Previously we had two types of macros for logging: with and without
message code. They were intended to be merged afterwards.
The idea is to use a special code – `XKB_LOG_MESSAGE_NO_ID = 0` – that
should *not* be displayed. But we would like to avoid checking this
special code at run time. This is achieved using macro tricks; they
are detailed in the code (see: `PREPEND_MESSAGE_ID`).
Now it is also easier to spot the remaining undocumented log entries:
just search `XKB_LOG_MESSAGE_NO_ID`.
|
|
b4e81ca1
|
2022-12-16T01:26:25
|
|
context: add XKB_CONTEXT_NO_SECURE_GETENV flag (#312)
This flag is useful for clients that may have relatively benign capabilities
set, like CAP_SYS_NICE, that also want to use the xkb configuration from the
environment and user configs in XDG_CONFIG_HOME.
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/308
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/129
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
0b3d9092
|
2022-03-14T16:44:13
|
|
scanner: prefix functions with `scanner_` to avoid symbol conflicts
Particularly `eof()` in mingw-w64.
Fixes: https://github.com/xkbcommon/libxkbcommon/pull/285
Reported-by: Marko Lindqvist
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
d7b39f6f
|
2020-07-10T08:50:02
|
|
Add /etc/xkb as extra lookup path for system data files
This completes the usual triplet of configuration locations available for most
processes:
- vendor-provided data files in /usr/share/X11/xkb
- system-specific data files in /etc/xkb
- user-specific data files in $XDG_CONFIG_HOME/xkb
The default lookup order user, system, vendor, just like everything else that
uses these conventions.
For include directives in rules files, the '%E' resolves to that path.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
05d6efc4
|
2020-07-10T15:16:50
|
|
xkbcomp: allow including kccgst files from other paths
Previously, a 'symbols/us' file in path A would shadow the same file in path B.
This is suboptimal, we rarely need to hide the system files - we care mostly
about *extending* them. By continuing to check other lookup paths, we make it
possible for a XDG_CONFIG_HOME/xkb/symbols/us file to have sections including
those from /usr/share/X11/xkb/symbols/us.
Note that this is not possible for rules files which need to be manually
controlled to get the right bits resolved.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
fadfb13c
|
2019-12-28T14:19:22
|
|
xkbcomp/rules: support \r\n line endings
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
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>
|
|
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>
|
|
00f31e0d
|
2019-11-13T11:38:39
|
|
rules: eliminate an extra fopen/fclose cycle
FindXkbFileInPath() opens the file so we're guaranteed that the file not only
exists, but that we can read it. Changing that would alter behavior so instead
let's just pass that file handle along and do the same for include files.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
ca033a29
|
2019-09-03T11:23:14
|
|
rules: add include statements to rules files
The majority use-case for extending XKB on a machine is to override one or a
few keys with custom keycodes, not to define whole layouts.
Previously, we relied on the rules file to be a single file, making it hard to
extend. libxkbcommon parses $XDG_CONFIG_HOME/xkb/ but that only works as long
as there is a rule that matches the user-specified RMLVO. This works for MLV
but not for options which don't have a wildcard defined. Users have to copy
the whole rules file and then work from there - not something easy to extend
and maintain.
This patch adds a new ! include directive to rules files that allows including
another file. The file path must be without quotes and may not start with the
literal "include". Two directives are supported, %H to $HOME and %S for the
system-installed rules directory (usually /usr/share/X11/xkb/rules).
A user would typically use a custom rules file like this:
! option = symbols
custom:foo = +custom(foo)
custom:bar = +custom(baz)
! include %S/evdev
Where the above defines the two options and then includes the system-installed
evdev rule. Since most current implementations default to loading the "evdev"
ruleset, it's best to name this $XDG_CONFIG_HOME/xkb/rules/evdev, but any
valid name is allowed.
The include functionally replaces the line with the content of the included
file which means the behavior of rules files is maintained. Specifically,
custom options must be defined before including another file because the first
match usually wins. In other words, the following ruleset will not assign
my_model as one would expect:
! include %S/evdev
! model = symbols
my_model = +custom(foo)
The default evdev ruleset has wildcards for model and those match before the
my_model is hit.
The actual resolved components need only be in one of the XKB lookup
directories, e.g. for the example above:
$ cat $XDG_CONFIG_HOME/xkb/symbols/custom
partial alphanumeric_keys
xkb_symbols "foo" {
key <TLDE> { [ VoidSymbol ] };
};
partial alphanumeric_keys
xkb_symbols "baz" {
key <AB01> { [ k, K ] };
};
This can then be loaded with the XKB option "custom:foo,custom:bar".
The use of "custom" is just as an example, there are no naming requirements
beyond avoiding already-used ones. Also note the bar/baz above - the option
names don't have to match the component names.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
3c57b328
|
2019-11-12T15:27:22
|
|
rules: move the matcher result handling to the caller
This shouldn't be processed in the matcher itself, especially in the glorious
future when we can have nested matchers. Only handle this once in the caller
to the original parsed file.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
2ec07b62
|
2019-11-12T14:19:55
|
|
rules: put the scanner on the stack
This allows nesting the scanner for the future !include directive.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
bb7551a6
|
2019-11-12T15:25:16
|
|
rules: simplify an error path
Initialize to NULL so we don't have to care about whether the cleanups can be
called or not.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
d9b98856
|
2019-11-12T14:39:47
|
|
rules: rename a variable from 's' to 'str'
To avoid name conflicts with a future patch.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
2a578a60
|
2019-11-12T14:17:44
|
|
rules: drop the matcher_err() macro and use scanner_err directly
No functional changes, this is what the macro expanded to anyway. Prep work
for putting the scanner on the stack and removing it from the matcher struct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
f57c13ea
|
2019-09-03T10:56:01
|
|
rules: factor out the function to parse a rules file
No functional changes, this just makes the part to parse a single rules file
re-usable.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
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>
|
|
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>
|
|
0224283f
|
2014-09-21T17:09:58
|
|
rules: fix mlvo-not-used warning
An mlvo can also be used in an expansion, but we didn't mark them in
this case in commit d8a4f52cb95d989b4. This caused wrongful warnings on
something like -l ch -v fr -- the `fr` is only added via expansion.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d8a4f52c
|
2014-09-20T16:13:24
|
|
rules: warn when an RMLVO component isn't used
Due to wildcard matches in the rules file, this is only really useful
for misspelled or missing options, e.g.
$ ./test/rmlvo-to-kccgst -o comprose:ralt > /dev/null
xkbcommon: ERROR: Unrecognized RMLVO option "comprose:ralt" was ignored
Although it is more of a warning, it indicates a misconfiguration which
the user probably wants to see. Therefore the log level is ERROR.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
61fed8da
|
2014-07-26T00:19:34
|
|
Replace darray_mem with a new darray_steal
That's a more declarative interface.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d6f2d8ec
|
2014-05-28T20:32:16
|
|
rules: fix leak on failure
matcher_match() builds up the kccgst's, and we steal the memory on
success. But on error we didn't free it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
28d5f770
|
2014-02-10T20:33:34
|
|
scanner: sort out scanner logging functions
First, make the rules and xkb scanners/parsers use the same logging
functions instead of rolling their own.
Second, use the gcc ##__VA_ARGS extension instead of dealing with C99
stupidity. I hope all relevant compilers support it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c4259ff2
|
2014-02-10T15:18:22
|
|
rules: always %-expand kccgst values
Previously the early-exit codepath might have left some values
unexpanded, and we'd go looking for e.g "%l%(v)".
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c11f05e0
|
2014-02-10T11:16:37
|
|
rules: print full path in error messages
There can be multiple include paths. But it's nicer in any case.
This also makes scanner_error actually use log_err instead of log_warn -
oops.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
537564cb
|
2014-02-10T11:11:27
|
|
rules: include the path in failed-to-map error message
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3923aa71
|
2014-02-09T11:27:34
|
|
doc: move some file comments into txt files in doc/
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
68b03097
|
2014-02-08T17:22:14
|
|
scanner: make line and column unsigned
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
cf513f70
|
2014-02-08T17:15:37
|
|
rules: get rid of struct location
Use the scanner token_{line,column} like we do in the other places.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
769b91c5
|
2014-02-08T15:30:05
|
|
Use (1u << idx) instead of (1 << idx) where appropriate
It doesn't matter (I think), since the implicit conversion doesn't have
any effect (e.g. sign-extension). But it's better to be aware of the
type.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
50b73ec0
|
2014-02-08T15:10:09
|
|
Use unsigned int for saving darray_size return value
See: b9b3593cbdeb7f5b02d50cecaba6a0b47d4979ad
So these should be unsigned int's now.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fa87cdb8
|
2014-02-07T19:39:42
|
|
darray: cleanup
We have quite diverged from the upstream file, so let's make it at least
easier to look at. Remove some unused macros and rename some for
consistency.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
65f9980b
|
2013-10-14T19:05:24
|
|
rules: fix scanning of line-continuation without leading space
We were failing to scan something like\
this correctly.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
dcdd4e10
|
2013-10-14T18:59:53
|
|
Replace ctype.h functions with ascii ones
ctype.h is locale-dependent, so using it in our scanners is not optimal.
Let's be deterministic with our own simple functions.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ca0d388f
|
2013-10-08T23:09:01
|
|
rules: simplify a bit of code
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fbed22e8
|
2013-10-08T22:58:28
|
|
rules: use strlen_safe
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
efe5b036
|
2013-10-08T22:37:53
|
|
rules: improve error logging macros
Improve safety with parenthesis, make the matcher macros use the scanner
ones, and make the 1 variant use %s instead of embedding the msg; this
way the compiler can reuse the string in the binary.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5af688e6
|
2013-10-08T21:46:01
|
|
rules: reduce variable scopes
There are some big functions there, and this might help reduce the
cognitive load a bit.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e4bceec8
|
2013-03-14T14:33:40
|
|
utils: add {un,}map_file to read an entire file
This wraps the current mmap call and adds a fallback implementation for
systems which do not have mmap (e.g. mingw).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
99f6e6fc
|
2013-03-14T14:31:55
|
|
Add scanner-utils.h for common scanner functions
We want to share the same functions for another scanner.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0513686b
|
2013-03-14T12:45:34
|
|
rules: be more paranoid in scanner
This can't happen, but better safe than sorry. The optimizations were
noticeable but negligible.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0e200bd5
|
2013-03-13T13:55:11
|
|
rules: quiet a gcc warning
src/xkbcomp/rules.c:620:36: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Can't happen but no harm done.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
bdea377c
|
2012-10-10T17:30:15
|
|
Rename XKB_NUM_GROUPS to XKB_MAX_GROUPS
This is a more appropriate name now.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ed1203df
|
2012-09-30T12:42:44
|
|
rules: always initialize idx variable
gcc didn't catch this one.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fcd20290
|
2012-09-21T14:44:17
|
|
Don't use xkbcommon-compat names in internal code
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b2110705
|
2012-09-16T14:45:32
|
|
Organize src/ and test/ headers
- Add context.h and move context-related functions from xkb-priv.h to
it.
- Move xkb_context definition back to context.c.
- Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it.
- Rename xkb-priv.h to map.h since it only contains keymap-related
definitions and declarations now.
- Remove unnecessary includes and some and some other small cleanups.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e670d084
|
2012-09-16T13:33:09
|
|
include: improve file-not-found error reporting
Only report it once, and not only for rules.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4d3d2ef0
|
2012-09-14T01:09:37
|
|
rules: fix mmap failure handling
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b4b40d73
|
2012-09-12T16:54:07
|
|
Copyright updates
With Dan Nicholson's permission (via email), update his copyright and
license statements to the standard X.Org boilerplate MIT license, as
both myself and Ran have been using.
Clean up my copyright declarations (in some cases to correct ownership),
and add copyright/license statements from myself and/or Ran where
appropriate.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
4b8ceae9
|
2012-08-21T12:45:03
|
|
kbproto untanglement: XkbKbdNumGroups
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
3b6b214c
|
2012-08-28T18:04:25
|
|
rules: use goto instead of state variable
There's no noticeable speed difference, but I think it's nicer and more
explicit than the previous code. Some people just don't like goto,
though..
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0071227e
|
2012-08-26T08:54:31
|
|
rules: rewrite
Rewrite the rules file parser for clarity, performance and memory usage
reduction. The previous implementation was quite hard to navigate and
did a lot of unnecessary work and copying.
This implementation keeps along just the state necessary, and doesn't
perform any copying of the file's content (although the entire file is
mmap'ed as before). Hopefully it's also easier to understand, has better
documentation, and better error checking and reporting. We try to
reproduce the previous behavior in every case.
Note: the diff is pretty confusing; it's likely better to look at the
file directly.
Benchmarks:
On an old 32-bit Intel processor.
gcc -O2 -pg
./test/rulescomp bench
grof test/rulescomp
Before:
compiled 1000 keymaps in 14.863564304s
% cumulative self self total
time seconds seconds calls ms/call ms/call name
49.33 4.43 4.43 30610000 0.00 0.00 yylex
17.93 6.04 1.61 31000 0.05 0.22 yyparse
6.57 6.63 0.59 1000 0.59 0.59 load_rules
3.23 6.92 0.29 3637000 0.00 0.00 AppendStmt
2.45 7.14 0.22 472000 0.00 0.00 AddKeySymbols
2.12 7.33 0.19 3591000 0.00 0.00 atom_intern
2.12 7.52 0.19 518000 0.00 0.00 FindNamedKey
2.00 7.70 0.18 230000 0.00 0.00 FreeStmt
1.78 7.86 0.16 1000 0.16 0.17 UpdateModifiersFromCompat
1.34 7.98 0.12 732000 0.00 0.00 AddKeyName
1.34 8.10 0.12 __x86.get_pc_thunk.bx
After:
compiled 1000 keymaps in 13.874666269s
% cumulative self self total
time seconds seconds calls ms/call ms/call name
49.82 4.26 4.26 30610000 0.00 0.00 yylex
22.22 6.16 1.90 31000 0.06 0.22 yyparse
2.92 6.41 0.25 3591000 0.00 0.00 atom_intern
2.57 6.63 0.22 1000 0.22 0.25 xkb_components_from_rules
2.11 6.81 0.18 3637000 0.00 0.00 AppendStmt
2.11 6.99 0.18 230000 0.00 0.00 FreeStmt
1.99 7.16 0.17 518000 0.00 0.00 FindNamedKey
1.99 7.33 0.17 1000 0.17 0.17 UpdateModifiersFromCompat
1.99 7.50 0.17 __x86.get_pc_thunk.bx
1.52 7.63 0.13 150000 0.00 0.00 AddInterp
1.40 7.75 0.12 472000 0.00 0.00 AddKeySymbols
On a newer 64-bit Intel processor.
gcc -O2
./test/rules-file bench
Before:
processed 20000 times in 15.940546625s
After:
processed 20000 times in 5.295026345s
Allocations:
gcc -O2
valgrind test/rulescomp
Before:
total heap usage: 257,519 allocs, 257,519 frees, 14,766,529 bytes allocated
After:
total heap usage: 240,756 allocs, 240,756 frees, 14,007,886 bytes allocated
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7f04ffc4
|
2012-08-29T12:10:28
|
|
rules: fix check for appending '|' character when applying
There are two ways to separate multiple files in XKB include statements:
'+' will cause the later file to override the first in case of conflict,
while '|' will cause it augment it (this is done by xkbcomp). '!' is
unrelated here.
Since '|' is practically never used, this wasn't noticed.
In the modified test, the '|some_compat' previously was just ignored.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
cdc228ea
|
2012-08-13T11:00:43
|
|
Organize xkbcomp/ header files
Various non-functional changes:
- Re-add keycodes.h and move some stuff there.
- Add parser-priv.h for internal bison/flex stuff.
- Don't include headers from other headers, such that file dependencies
are immediate in each file.
- Rename xkbcomp.h -> ast.h, parseutils.{c,h} -> ast-build.{c,h}
- Rename path.{c,h} -> include.{c,h}
- Rename keytypes.c -> types.c
- Make the naming of XkbFile-related functions more consistent.
- Move xkb_map_{new,ref,unref} to map.c.
- Remove most extern keyword from function declarations, it's just
noise (XKB_EXPORT is what's important here).
- Append XKBCOMP_ to include guards.
- Shuffle some code around to make all of this work.
Splitting this would be a headache..
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3634b156
|
2012-08-14T11:49:19
|
|
Allocate xkb_component_names on stack
Instead of malloc'ing it as well. Also improve the error handling.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5a51ce8b
|
2012-08-09T01:55:30
|
|
Fix warning
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d5f725f6
|
2012-08-03T05:13:46
|
|
Rules: mmap() rules file instead of using getc()
Good for a small performance win on my system.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
42b2c934
|
2012-08-03T03:22:48
|
|
Print failed include paths on failure to find rules
Thus giving a hint as to which directory we're trying to find.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
89723b7c
|
2012-07-24T19:54:14
|
|
utils: add/replace string equality macros
It's more tidy and less error prone, since we use strcasecmp == 0 a lot.
We replace strcmp == 0 by streq, strcasecmp == 0 by istreq,
uStrCasePrefix by istreq_prefix and uDupString by strdup_safe.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3bb3e9c3
|
2012-07-21T15:19:27
|
|
rules: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9308a460
|
2012-07-17T10:20:15
|
|
Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually
fix up a few things: it really likes justifying struct initialisers.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
19f814f9
|
2012-07-11T14:08:28
|
|
rules: fix parsing of multiple options
This was broken by commit 18d331b86b4942ba54fe087ca07e47c9383d768b
(where only the first option out of a comma-separated string was
matched). Do it correctly this time and add a test.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
37f43849
|
2012-06-30T00:49:41
|
|
rules: remove support for keymap rule
This commit removes the ability to specify a keymap *in a rules file*,
e.g. in /usr/share/X11/xkb/rules/evdev or somesuch. This is unused in
xkeyboard-data, and the current code has never even supported it,
because xkb_map_new_from_kccgst (which is no longer exposed in the API)
checks to see that one of the usual components (e.g. symbols, types, ..)
has been filled, while the rules parser, on the other hand, doesn't
allow to specify a keymap and other stuff at the same time.
( The idea was to remove xkb_map_new_from_kccgst entirely, but it's used
by a test so it can stay. )
tl;dr: dead code. Of course passing a keymap file to
xkb_map_new_from_file still works.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
48b4d30a
|
2012-06-29T17:05:33
|
|
Use enum for file types
enums are nice for some type safety and readability. This one also
removes the distinction between file type mask / file type index and
some naming consistency.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
bc50cdd4
|
2012-06-05T18:46:24
|
|
darray: some changes for convenience
- Make darray_free also initialize the array back to an empty state, and
stop worrying about it everywhere.
- Add darray_mem, to access the underlying memory, which we do manually
now using &darray_item(arr, 0). This makes a bit more clear when we
actually mean to take the address of a specific item.
- Add darray_copy, to make a deep copy of a darray.
- Add darray_same, to test whether two darrays have the same underlying
memory (e.g. if the struct itself was value copied). This should used
where previously two arrays were compared for pointer equality.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
57f184e2
|
2012-05-30T15:55:21
|
|
darray: tweak parameters a bit for better memory usage
Here are some quick numbers from valgrind, running rulescomp only with a
simple, common "us,de" rule set:
before darray: cb047bb
total heap usage: 44,924 allocs, 44,924 frees, 3,162,342 bytes allocated
after darray: c87468e
total heap usage: 52,670 allocs, 52,670 frees, 2,844,517 bytes allocated
tweaking specific inital allocation sizes:
total heap usage: 52,652 allocs, 52,652 frees, 2,841,814 bytes allocated
changing initial alloc = 2 globally
total heap usage: 47,802 allocs, 47,802 frees, 2,833,614 bytes allocated
changing initial alloc = 3 globally
total heap usage: 47,346 allocs, 47,346 frees, 3,307,110 bytes allocated
changing initial alloc = 4 globally
total heap usage: 44,643 allocs, 44,643 frees, 2,853,646 bytes allocated
[ Changing the geometric progression constant from 2 only made things
worse. I tried the golden ratio - not so golden :) ]
The last one is obviously the best, so it was chosen, with the specific
tweaks thrown in as well (these were there before but don't make much
difference). Overall it seems to do better than the previous manual
allocations which is a bit surprising.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
28bbb7dc
|
2012-05-21T23:47:44
|
|
rules: use darray for rules and groups
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0c271e09
|
2012-05-22T00:14:34
|
|
rules: use darray for input line
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7895eeb8
|
2012-05-18T19:39:25
|
|
rules: reformat LoadRules and XkbRF_Free
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
56b125fc
|
2012-05-18T18:38:06
|
|
rules: reformat AddRule and AddGroup
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f790257f
|
2012-05-18T18:34:47
|
|
rules: reformat GetComponents
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
68edd5f0
|
2012-05-19T12:50:47
|
|
rules: allow wildcard match against "" layout/varaint
Currently, if you pass in an rmlvo with an empty string for layout or
variant, it would not match layout and variant rules even with
wildcards. But if the rules file had set an appropriate default, and someone
passes in the empty string, than he should get the default.
NULL in this case signifies not wanting to match against the layout or
variant at all, and so the rule should still fail to match NULLs.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c900c417
|
2012-05-19T01:00:52
|
|
rules: remove struct var_defs
We can just use struct xkb_rule_names which we already receive as an
argument.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3d28b6d1
|
2012-05-19T00:53:57
|
|
rules: reformat components_from_rules
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d18cf315
|
2012-05-18T19:37:01
|
|
rules: remove unused struct describe_vars
It's not actually used for anything.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
52939d4b
|
2012-05-18T18:25:59
|
|
rules: reformat SubstituteVars
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a9477b57
|
2012-05-18T12:02:29
|
|
rules: reformat CheckApplyRules and ApplyPartialMatches
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
18d331b8
|
2012-05-18T11:01:20
|
|
rules: rewrite MatchOneOf
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
06205717
|
2012-05-18T02:53:29
|
|
rules: reformat MakeMultiDefs
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b8ae68c2
|
2012-05-17T13:55:38
|
|
rules: rewrite get_index to use sscanf
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ef76ba97
|
2012-05-16T10:09:03
|
|
rules: don't typedef the structs and rename them
The long prefix is unnecessary now that they are all private.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
478a6a31
|
2012-05-16T09:49:32
|
|
rules: reformat input line handling
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b73bd676
|
2012-05-13T09:49:08
|
|
rules: only export a single function
Really all we need from this file is a way to get xkb_component_names
from an xkb_rule_names, which is now the only thing being exposed. This
should allow for some much needed refactoring of this code.
Since this is only used by xkbcomp.c and uses xkbcomp functions, also
move rules.{c,h} under the xkbcomp dir.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a47dd252
|
2012-05-18T10:43:24
|
|
rules: reformat CheckGroup and CheckApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c02c9ab2
|
2012-05-18T10:33:38
|
|
rules: reformat ApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f7de6286
|
2012-05-18T02:20:14
|
|
rules: use asprintf instead of _Concat function
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
72d1f2ed
|
2012-05-16T09:39:01
|
|
rules: don't use custom logging functions
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5f54764d
|
2012-05-17T16:15:46
|
|
rules: reformat CheckLine and break into several functions
And remove struct file_spec which is really unneeded. Should be
slightly more clear now.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2df35895
|
2012-05-17T14:18:31
|
|
rules: reformat SetUpRemap and struct remap_spec
Rename to more descriptive names and reformat.
Signed-off-by: Ran Benita <ran234@gmail.com>
|