kc3-lang/libxkbcommon/src/xkbcomp/action.c

Branch :


Log

Author Commit Date CI Message
14a816e5 2025-02-11 18:41:08 xkbcomp: Fix int cast
558447d8 2025-02-11 17:34:27 xkbcomp: Explicit vars initialization The `Resolve*` functions do not always initialize the parameters that they can modify, so it is safer to always initialize them at the call site.
97698fca 2025-02-11 17:34:23 xkbcomp: Use explicit int sizes for Expr resolution
a4d782c7 2025-02-06 16:00:19 xkbcomp/ast: remove ExprCommon It's now empty and no longer serves a purpose. Signed-off-by: Ran Benita <ran@unusedvar.com>
9d7eb849 2025-02-06 15:25:03 xkbcomp/ast: combine expr_value_type into stmt_type This field is a funky attempt at type inference, or perhaps some optimization? Anyway, after careful examination I conclude it serves no purpose except specifying the type of a literal (string/integer/float/boolean/keyname) when `STMT_EXPR_VALUE` (i.e. literal). Remove it and replace `STMT_EXPR_VALUE` with specific statement types for each literal type. Signed-off-by: Ran Benita <ran@unusedvar.com>
d9fc01b3 2025-02-06 15:12:53 xkbcomp/ast: combine expr_op_type into stmt_type It's better to have a single AST type enum. Signed-off-by: Ran Benita <ran@unusedvar.com>
e120807b 2025-01-29 15:35:22 Update license notices to SDPX short identifiers + update LICENSE Fix #628. Signed-off-by: Ran Benita <ran@unusedvar.com>
842497d9 2025-01-22 16:46:11 clang-tidy: Fix implicit or incorrect integer casts
9ef45dc5 2025-01-21 19:55:47 Fix incompatible pointer types with enums The enum casts can possibly lead to unaligned access. The warnings trigger in the Windows CI but not on Linux. One may use `-fshort-enums` with gcc in order to trigger the errors.
b1aecd47 2025-01-21 17:51:56 actions: Fix SwitchScreen screen value range Currently we accept values of -255..255 while parsing the screen value of `SwitchScreen` actions`, but then we silently cast it against `int8_t`, i.e. in range -128..127. We actually do as xkbcomp, but this seems a bug because the target storage is a `char`. Let’s simply raise a parse error if the value does not fit in our type.
fdcd458c 2024-09-24 21:20:29 nit: Format files
13b36a76 2024-03-01 15:02:41 Global default statement: Improve code & error message - Simplify error handling. - Improve error message: add message ID and relevant quotes and try to standardize a bit. - Add proper doc for in the message registry. Note: Instead of testing the value of `expr.op`, we test if the argument `elem` of `ExprResolveLhs` is set: this allows us to catch also the error with `x.y[z]` rather than just `x.y` as previously.
c0065c95 2023-09-21 20: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`.
ef81d04e 2023-09-18 18:17:34 Structured log messages with a message registry Currently there is little structure in the log messages, making difficult to use them for the following use cases: - A user looking for help about a log message: the user probably uses a search engine, thus the results will depend on the proper indexing of our documentation and the various forums. It relies only on the wording of the message, which may change with time. - A user wants to filter the logs resulting of the use of one of the components of xkbcommon. A typical example would be testing xkeyboard-config against libxkbcommon. It requires the use of a pattern (simple words detection or regex). The issue is that the pattern may become silently out-of-sync with xkbcommon. A common practice (e.g. in compilers) is to assign unique error codes to reference theses messages, along with an error index for documentation. Thus this commit implements the following features: - Create a message registry (message-registry.yaml) that defines the log messages produced by xkbcommon. This is a simple YAML file that provides, for each message: - A unique numeric code as a short identifier. It is used in the output message and thus can be easily be filtered to spot errors or searched in the internet. It must not change: if the semantics of message changes, it is better to introduce a new message for clarity. - A unique text identifier, meant for two uses: 1. Generate constants dealing with log information in our code base. 2. Generate human-friendly names for the documentation. - A type: currently warning or error. Used to prefix the constants (see hereinabove) and for basic classification in documentation. - A short description, used as concise and mandatory documentation. - An optionnal detailed description. - Optional examples, intended to help the user to fix issues themself. - Version of xkbcommon it was added. For old entries this often unknown, so they will default to 1.0.0. - Version of xkbcommon it was removed (optional) No entry should ever be deleted from this index, even if the message is not used anymore: it ensures we have unique identifiers along the history of xkbcommon, and that users can refer to the documentation even for older versions. - Add the script update-message-registry.py to generate the following files: - messages.h: message code enumeration for the messages currently used in the code base. Currently a private API. - message.registry.md: the error index documentation page. - Modify the logging functions to use structured messages. This is a work in progress.
20f7f80c 2021-03-29 16:23:28 xkbcomp: use memcpy over strncpy to avoid analyzer warnings The target buffer is 7 bytes long, null-termination is optional (as the comment already suggests). Coverity is unhappy about this though so let's use memset and memcpy instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
40aab05e 2019-12-27 13: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>
c8168297 2018-08-01 18:47:24 action: make a note that we may not null-terminate private strings Coverity complains that a 7-byte string may not be null-terminated when copied into act->data (size 7). This is fine, make a note of it. All the strings in xkeyboard-config only use 6 bytes + null terminator so this won't be an issue. The server (the only user of these) uses an 8-byte array and forcibly null-terminates the string, see XkbDDXPrivate(). Everything else treats it as byte-array size 7 anyway so whether it's null-terminated doesn't matter. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
0b7c8d61 2013-02-08 14:32:47 action: take xkb_mod_set instead of the entire keymap A couple of modiifer actions need this information, but not the entire keymap. Signed-off-by: Ran Benita <ran234@gmail.com>
9fbcf6bb 2013-02-08 13:56:41 expr: take xkb_mod_set instead of the entire keymap The modifier-resolving functions only need the modifier information. Signed-off-by: Ran Benita <ran234@gmail.com>
999f3792 2014-04-16 22:43:30 action: convert a few missed unsigned -> enum xkb_action_type Signed-off-by: Ran Benita <ran234@gmail.com>
1fa7d6d3 2014-02-16 18:32:44 action: unify SetLatch and Lock handler functions This is a little shorter and follows easier from the spec flag description table. Also a few were too permissive (like allowing LatchToLock in SetMods). Signed-off-by: Ran Benita <ran234@gmail.com>
af75353a 2014-02-16 10:20:32 action: add a common CheckBooleanFlag function Signed-off-by: Ran Benita <ran234@gmail.com>
18191702 2014-02-16 10:59:42 keymap: change action flag NO_ACCEL -> ACCEL It's easier to deal with, but we need to set it as "factory default". Signed-off-by: Ran Benita <ran234@gmail.com>
af261cb6 2014-02-16 10:22:32 action: fix SwitchScreen "same" field handling This used to *unset* a flag called "SwitchApplication"; we changed the flag to "same" but forgot to switch the cases. Signed-off-by: Ran Benita <ran234@gmail.com>
efe2880e 2014-02-15 22:28:41 action: don't pass a keymap where a ctx is sufficient Signed-off-by: Ran Benita <ran234@gmail.com>
3acea3b3 2014-02-15 22:16:41 action: add missing array_ndx checks Only the "data" field can have them, and every other field needs to error out if it appears. But some didn't check. Signed-off-by: Ran Benita <ran234@gmail.com>
477407f7 2014-02-15 21:55:36 action: move array_ndx errors into the Check functions Makes more sense and flows more nicely this way. Signed-off-by: Ran Benita <ran234@gmail.com>
7c5e7915 2014-02-15 21:48:31 action: fix missing support for "affect" field Support for setting this field was missing from the LockMods and LockControls actions. Based on a xkbcomp patch by Andreas Wettstein. Signed-off-by: Ran Benita <ran234@gmail.com>
6248b09f 2014-02-13 23:11:31 action: simplify Check* functions Instead of using those t1 t2 variables, pass the final destinations directly (while making sure they are not modified in case of error). This also ensures the types are right, e.g. in CheckGroupField it should be int32_t, not xkb_layout_index_t (and indeed it takes a negation!). Signed-off-by: Ran Benita <ran234@gmail.com>
e2c336cb 2014-02-08 15:06:28 action: fix misleading cast The type is uint8_t and so is the checked range. Signed-off-by: Ran Benita <ran234@gmail.com>
bbd2a9c0 2014-02-08 15:05:05 action: fix printing of underflowed value in error message Signed-off-by: Ran Benita <ran234@gmail.com>
623b10f8 2014-02-08 00:27:54 Fix sign-compare warnings Signed-off-by: Ran Benita <ran234@gmail.com>
e9e39932 2014-02-07 18:49:22 action: Use ResolveInteger for PtrBtn.count, not ResolveButton It's not a button. Signed-off-by: Ran Benita <ran234@gmail.com>
e0137cac 2014-02-07 18:48:16 action: check range of MovePtr X,Y values Signed-off-by: Ran Benita <ran234@gmail.com>
bbc69b63 2014-01-12 10:53:23 action, types: remove unused Report functions Signed-off-by: Ran Benita <ran234@gmail.com>
31430670 2014-01-11 16:40:42 Fix some cppcheck warnings Someone was nice enough to run this for us: ftp://ftp.sunet.se/pub/Linux/distributions/Debian/debian/pool/main/libx/libxkbcommon/libxkbcommon_0.3.1.orig.tar.gz [libxkbcommon-0.3.1/src/keymap.c:86]: (style) The scope of the variable 'j' can be reduced. [libxkbcommon-0.3.1/src/keymap.c:87]: (style) The scope of the variable 'key' can be reduced. [libxkbcommon-0.3.1/src/keysym-utf.c:843]: (style) The scope of the variable 'mid' can be reduced. [libxkbcommon-0.3.1/src/state.c:992]: (style) The scope of the variable 'str' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/action.c:467]: (style) The scope of the variable 'absolute' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:468]: (style) The scope of the variable 'consumed' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:862]: (style) The scope of the variable 'mlvo' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:863]: (style) The scope of the variable 'kccgst' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:865]: (style) The scope of the variable 'match_type' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/symbols.c:753]: (style) The scope of the variable 'toAct' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/symbols.c:1573]: (style) The scope of the variable 'key' can be reduced. [libxkbcommon-0.3.1/test/common.c:80]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [libxkbcommon-0.3.1/test/interactive.c:358]: (style) The scope of the variable 'nevs' can be reduced. [libxkbcommon-0.3.1/test/interactive.c:236]: (style) Checking if unsigned variable 'nsyms' is less than zero. [libxkbcommon-0.3.1/test/interactive.c:226]: (style) Unused variable: unicode Signed-off-by: Ran Benita <ran234@gmail.com>
972395b8 2013-12-01 12:08:47 expr: split expression types and allocate them separately Currently, we have one ExprDef type, which contains a tagged union with the value of all expression types. Turns out, this union is quite wasteful memory-wise. Instead, create separate types for all expressions (e.g ExprBinary, ExprInteger) which embed the common fields (ExprCommon), and malloc them per their size; ExprDef then becomes a union of all these types, but is just used as a generic pointer. [Instead of making ExprDef a union, another option is to use ExprCommon as the generic pointer type and then do up-castings, like we do with ParseCommon. But this makes the code much uglier.] The diff is mostly straightforward mechanical adaptations. It could have been much smaller with the help of C11 anonymous structs (which were previously a gnu extension). This will have saved all of the 'op' -> 'expr->op', etc changes. But if we can be a bit more portable for a little effort, we should. Before (./test/rulescomp, x86 32 bit, -O2): ==12974== total heap usage: 145,217 allocs, 145,217 frees, 10,476,238 bytes allocated After: ==11145== total heap usage: 145,217 allocs, 145,217 frees, 8,270,358 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com>
c24b6420 2013-11-30 23:24:18 expr: add constructor for boolean expressions Also add a 'bool set' to the ExprDef union, instead of using 'ival' as a bool. Signed-off-by: Ran Benita <ran234@gmail.com>
dbd8b1ef 2013-11-30 22:25:39 expr: add 'ident' value to ExprDef union This distinguishes between an identifier expression and a string expression in the union. Signed-off-by: Ran Benita <ran234@gmail.com>
6a39a065 2013-03-04 18:35:56 Fix pointer style nit (I really dislike this one for some reason..) Signed-off-by: Ran Benita <ran234@gmail.com>
71eb033e 2013-03-03 21:35:43 Move a couple of general keymap functions from keycodes.c To get a key by name and resolve an alias - this makes sense for everyone. Signed-off-by: Ran Benita <ran234@gmail.com>
540feef3 2013-03-01 13:51:13 More spelling errors Signed-off-by: Ran Benita <ran234@gmail.com>
60bb639b 2013-02-08 14:03:36 action: s/hndlrType/handler_type Signed-off-by: Ran Benita <ran234@gmail.com>
998c957a 2012-10-30 18:21:56 action: don't allow private actions with a known type Some obscure bug having to do with Private actions; see the comments. This was prompted by: https://bugs.freedesktop.org/show_bug.cgi?id=56491 Signed-off-by: Ran Benita <ran234@gmail.com>
a1124b59 2012-10-06 17:42:21 expr: unify the real and virtual modifier functions This again pushes the mod type annotation to the original call site, to make it easier to grep to see where the real/virtual distinction matters. Signed-off-by: Ran Benita <ran234@gmail.com>
fe1faa14 2012-10-03 20:08:13 Use our types instead of int/uint32_t in a few places Signed-off-by: Ran Benita <ran234@gmail.com>
26cc2f40 2012-09-30 14:17:08 Don't use %z printf format Some libc's don't support it. Signed-off-by: Ran Benita <ran234@gmail.com>
fcd20290 2012-09-21 14:44:17 Don't use xkbcommon-compat names in internal code Signed-off-by: Ran Benita <ran234@gmail.com>
18a0ead5 2012-09-14 15:17:20 Rename ACTION_TYPE_LAST to _ACTION_TYPE_NUM_ENTRIES It's not really "last" per-se, and we use this other format in some other enums. Signed-off-by: Ran Benita <ran234@gmail.com>
b4b40d73 2012-09-12 16: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>
461f8a76 2012-09-10 20:40:05 actions: Remove PointerDefault affect field This was always set to affect the default button, so no need for it. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
70c775f6 2012-09-10 20:38:46 kbproto unentanglement: action flags Signed-off-by: Daniel Stone <daniel@fooishbar.org>
0b2506db 2012-09-10 19:23:16 kbproto unentanglement: action types Signed-off-by: Daniel Stone <daniel@fooishbar.org>
314965b1 2012-08-21 14:40:51 Remove deprecated actions We didn't do anything with ISO_Lock, ActionMessage, RedirectKey, and the device-specifying variants of the pointer actions, so remove those. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
b04d896a 2012-08-21 12:48:20 kbproto unentanglement: XkbNumVirtualMods Signed-off-by: Daniel Stone <daniel@fooishbar.org>
f5dffd2b 2012-08-21 11:21:19 kbproto untanglement: XkbKeyNameLength Define it ourselves as XKB_KEY_NAME_LENGTH and use that, instead of the one from XKB.h. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
af2a8b3a 2012-09-02 21:45:42 Unify some string tables from xkbcomp, text and keymap-dump We move the LookupEntry struct from expr.h to text.h, along with most of the lookup tables. This makes them available everywhere. Looking up a value in the LookupEntry format is slower than direct index mapping, but it allows multiple names per value (with the canonical one being first) and "all"- and "none"-type masks. These functions are not used anywhere efficiency matters. Signed-off-by: Ran Benita <ran234@gmail.com>
1a996883 2012-08-31 19:05:49 expr: make ResolveString return an atom Almost all callers do xkb_atom_intern on the currently returned string, while ResolveString converts the atom to the string to begin with... uselss double work. Signed-off-by: Ran Benita <ran234@gmail.com>
95d4fb9e 2012-09-03 10:28:58 action: fix LookupEntry for "lockdevbtn" xkbcomp has that bug as well, guess no one uses it. Signed-off-by: Ran Benita <ran234@gmail.com>
7e0c49e0 2012-09-02 16:33:02 action: remove redundant check The NoAction handler always errors out with the same message. Signed-off-by: Ran Benita <ran234@gmail.com>
87bfd973 2012-09-02 11:29:31 action: keep array of default actions, instead of list of changes The implementation of changing the default properties of actions, e.g. a statements such as (from test/data/compat/basic): setMods.clearLocks= True; latchMods.clearLocks= True; latchMods.latchToLock= True; works by keeping a list of ActionInfo's, each containing the neccesary info from each statement, and then when some action comes up (e.g. in an interpret statment) it goes through the list, and applies the relevent ActionInfo's to the newly-constructed xkb_action. Instead of doing this, we add a struct ActionsInfo, which contains an array of xkb_actions, one for each type. When a default changing statement appears, we change the action in the array; when a new action comes up, we just copy from the array. This is simpler to figure out, and pretty straightforward. Signed-off-by: Ran Benita <ran234@gmail.com>
4ca85c7b 2012-09-02 16:16:57 action: disallow setting an action_field default for all types Currently where it is possible to write: setMods.clearLocks = True; It's also possible to write: action.clearLocks = True; This will set the default value for the clearLocks action field for *all* action types, as opposed to just setMods in this case. If subsequently an action is used for which this field does not make sense, it will error out. This doesn't make any sense, because any given field is only possible by at most 3 or 4 action types... which you might as well write explicitly and avoid the side effect mentioned above. Needless to say this is one of xkbcomp's "hidden features" and is not used anywhere; remove it. Signed-off-by: Ran Benita <ran234@gmail.com>
ba9f66bd 2012-09-02 10:35:08 action: clean up formatting of extern functions Make it a bit easier to understand what they do. Signed-off-by: Ran Benita <ran234@gmail.com>
d3ddcf70 2012-08-15 21:45:02 expr: move op_type/value_type_to_string functions to ast Generally the enum-to-string function should appear where the enum is defined. Signed-off-by: Ran Benita <ran234@gmail.com>
e9aa84f3 2012-08-14 15:06:11 compat: small changes Signed-off-by: Ran Benita <ran234@gmail.com>
79a2cc09 2012-08-11 11:54:05 action: convert action field type to enum We can also hide the ActionInfo definition inside action.c. Signed-off-by: Ran Benita <ran234@gmail.com>
cdc228ea 2012-08-13 11: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>
4c34bda1 2012-08-10 22:38:07 action: get rid of xkb_any_action And use union xkb_action instead. We add xkb_private_action, which is the same as xkb_any_action, but only used where the intention is clear. This should take care of whatever sizing changes the action struct might have. Signed-off-by: Ran Benita <ran234@gmail.com>
87dff888 2012-08-10 18:14:35 Store actions inside struct xkb_key Cuts out a lot of useless redirection and space. Signed-off-by: Ran Benita <ran234@gmail.com>
34e690ce 2012-08-10 13:08:03 Remove AutoKeyNames feature If this keymap flag is set, whenever a key name appears in one of the sections which does not exist (i.e. has not been declared in keycodes), it finds the first unused keycode and attaches it that name. This might have been useful when you could compile the symbols section or geometry section without a keycodes section, but we don't support this anymore. It's also pretty useless for any real work, because the user has no way of knowing the keycode and so it will never be used. Finally the only obscure way left to set this flag is by including a keycodes file called "computed". Just remove it. Signed-off-by: Ran Benita <ran234@gmail.com>
07b18bde 2012-08-09 02:33:51 Modernize struct xkb_mods Currently xkb_mods has the following members: - uint8_t real_mods - 8 X11 core mods - xkb_mod_mask_t vmods - 16 virtual mods, zero-based index - xkb_mod_mask_t mask - the computed effective *real* modifier mask, basically a cache for the first two which is: real_mods | real mods computed from vmods Our API acts on masks which combine the real_mods and vmods into a single value, which is: 8 first bits real mods | 16 next bits virtual mods (XkbNumModifiers = 8, XkbNumVirtualMods = 16). This is also the format which ResolveVModMask uses (which is where all the modifier masks really "come from", e.g. "Shift+Lock+Level5" -> xkb_mod_mask_t). What the code does now after getting the mask from ResolveVModMask, is to break it into real part and virtual part and store them seperately, and then join them back together when the effective mask is calculated. This is all pretty useless work. We change xkb_mods to the following: - xkb_mod_mask_t mods - usually what ResolveVModMask returns - xkb_mod_mask_t mask - the computed mask cache And try to consistently use the word "mods" for the original, non-effective mods and mask for the effective mods (which can only contain real mods for now, because things break otherwise). The separation is also made clearer. The effective masks are computed by UpdateModifiersFromCompat after all the sections have been compiled; before this the mask field is never touched; after this (i.e. map.c and state.c) the original mods field is never touched. This single execption to this rule is keymap-dump.c: it needs to print out only the original modifiers, not computed ones. This is also the reason why we actually keep two fields instead keeping one and modifying it in place. The next logical step is probably to turn the real mods into vmods themselves, and get rid of the distinction entirely (in a compatible way). Signed-off-by: Ran Benita <ran234@gmail.com>
6b75dd2d 2012-08-05 19:38:31 Fix virtual modifiers mask extraction The calculations were performed incorrectly in several places, specifically shifting by 16 instead of 8 (= XkbNumModifiers) and masking with 0xff instead of 0xffff. More stuff that probably never worked as intended. This also makes these more grep-able when we remove the vmods/real_mods separation. Signed-off-by: Ran Benita <ran234@gmail.com>
4c00278c 2012-08-02 01:09:41 Remove xproto build dependency Very little left to do for this. Signed-off-by: Ran Benita <ran234@gmail.com>
b804aec2 2012-08-03 00:20:07 action: drop global actionInitialized The action.c needs to use two constant Expr values, constTrue and constFalse. To do this is keeps to static globals Expr's of type boolean and the values "true" and "false" which need to be interned (and thus context specific). The interning means they can't be made static const, so there's a global flag and initializer function. Instead of using this unsafe global state, we can simply use an integer boolean expression (1 and 0) instead of a string one ("true" and "false") and make them const. Signed-off-by: Ran Benita <ran234@gmail.com>
6f08a2cf 2012-08-03 00:33:40 expr: constify function arguments We need this for later. Signed-off-by: Ran Benita <ran234@gmail.com>
41d9afc5 2012-07-27 15:31:03 Remove ExprResult Convert the IdentLookup typedef away from ExprResult, which drags along everything else. This should also make all of the conversions explicit. Signed-off-by: Ran Benita <ran234@gmail.com>
38614c88 2012-07-24 17:21:29 expr: drop ExprResult from ResolveMask Signed-off-by: Ran Benita <ran234@gmail.com>
bd927abf 2012-07-24 19:39:59 expr: drop ExprResult from ResolveEnum Signed-off-by: Ran Benita <ran234@gmail.com>
d5682289 2012-07-24 01:22:26 expr: drop ExprResult from ResolveButton Signed-off-by: Ran Benita <ran234@gmail.com>
27f94929 2012-07-23 15:46:50 expr: drop ExprResult from ResolveString Signed-off-by: Ran Benita <ran234@gmail.com>
025ca579 2012-07-23 12:20:05 expr: drop ExprResult from ResolveLhs Signed-off-by: Ran Benita <ran234@gmail.com>
2e4933cd 2012-07-24 10:39:15 expr: drop ExprResult from ResolveInteger Signed-off-by: Ran Benita <ran234@gmail.com>
e258f9ee 2012-07-24 00:10:07 expr: drop ExprResult from ResolveGroup Signed-off-by: Ran Benita <ran234@gmail.com>
0d262fa1 2012-07-23 19:52:17 expr: drop ExprResult from ResolveBoolean Signed-off-by: Ran Benita <ran234@gmail.com>
761b675c 2012-07-23 11:56:13 expr: drop ExprResult from ResolveKeyName Explicit is better than implicit, and this union makes it hard to follow what's what, particularly the confusion with ival/uval. The other Resolve functions will follow. Signed-off-by: Ran Benita <ran234@gmail.com>
724f62c8 2012-07-25 17:29:08 Convert defines to enums in xkbcomp.h For statement / expression types. Signed-off-by: Ran Benita <ran234@gmail.com>
89723b7c 2012-07-24 19: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>
4f843c81 2012-07-24 13:24:59 Drop Xkbc prefix of text functions Not really needed and inconsistent. Signed-off-by: Ran Benita <ran234@gmail.com>
6cb98200 2012-07-24 13:15:40 Use xkb_mod_mask_t and xkb_mask_index_t throughout Signed-off-by: Ran Benita <ran234@gmail.com>
74be1762 2012-07-23 21:30:28 Remove alloc.{c,h} These functions are more appropriate elsewhere now. Signed-off-by: Ran Benita <ran234@gmail.com>
112cccb1 2012-07-23 16:03:34 Some atom related optimizations 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 instead we can have the interning "steal" the memory instead of allocing a new one and freeing the old one. This is done by a new xkb_atom_steal function. It also turns out, that 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 some more dynamic allocations. For this change we had to remove the ability to append two strings, e.g. "foo" + "bar" -> "foobar" which is only possible with string literals. This is unused and quite useless for our purposes. xkb_atom_strdup is left unused, as it may still be useful. Running rulescomp in valgrind, Before: ==7907== total heap usage: 173,698 allocs, 173,698 frees, 9,775,973 bytes allocated After: ==6348== total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com>
d659f2b4 2012-07-21 15:12:31 expr: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
e037f518 2012-07-21 14:53:49 action: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
8b0e9f92 2012-07-20 13:07:30 utils: remove uTypedAlloc/Calloc Signed-off-by: Ran Benita <ran234@gmail.com>
50b25a12 2012-07-17 11:03:43 Use xkb_group_index_t for group variables throughout Signed-off-by: Ran Benita <ran234@gmail.com>
dfa0929c 2012-07-16 22:15:43 Convert macros to inline functions Signed-off-by: Ran Benita <ran234@gmail.com>
d0097f4e 2012-07-15 15:55:34 Pass around xkb_key's instead of keycodes This way we don't need to look up the key every time. We now only deal with keycodes in the public API and in keycodes.c. Also adds an xkb_foreach_key macro, which is used a lot. Signed-off-by: Ran Benita <ran234@gmail.com>
7d9f0313 2012-07-15 13:00:04 Get rid of struct xkb_key_name Just embed it directly. Signed-off-by: Ran Benita <ran234@gmail.com>
81d029f5 2012-07-15 11:52:54 Replace xkb_keycode_t 'key' variable name by 'kc' We want to reserve the name 'key' for something else. Signed-off-by: Ran Benita <ran234@gmail.com>
9308a460 2012-07-17 10: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>