summaryrefslogtreecommitdiff
path: root/src/keymap.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-04-22 12:23:36 +0300
committerRan Benita <ran234@gmail.com>2014-04-22 14:56:44 +0300
commit787faf36654ed75672613c560286caddadce3ec5 (patch)
treea3d72f5562234c15141faa3331f6ad1550e0df07 /src/keymap.h
parent6b1cdee107caaf8009037763a3cc3cd51132a1dd (diff)
downloadxorg-lib-libxkbcommon-787faf36654ed75672613c560286caddadce3ec5.tar.gz
keymap: don't use darray in xkb_mod_set
Instead just statically allocate the mods array (of size MAX_MOD_SIZE = 32). The limit is not going anywhere, and static allocations are nicer (nicer code, no OOM, etc.). It's also small and dense enough. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/keymap.h')
-rw-r--r--src/keymap.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/keymap.h b/src/keymap.h
index ed2f8e7..91f271a 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -354,7 +354,8 @@ struct xkb_mod {
};
struct xkb_mod_set {
- darray(struct xkb_mod) mods;
+ struct xkb_mod mods[XKB_MAX_MODS];
+ unsigned int num_mods;
};
/* Common keyboard description structure */
@@ -403,10 +404,14 @@ struct xkb_keymap {
(iter)++)
#define xkb_mods_foreach(iter, mods_) \
- darray_foreach((iter), (mods_)->mods)
+ for ((iter) = (mods_)->mods; \
+ (iter) < (mods_)->mods + (mods_)->num_mods; \
+ (iter)++)
#define xkb_mods_enumerate(idx, iter, mods_) \
- darray_enumerate((idx), (iter), (mods_)->mods)
+ for ((idx) = 0, (iter) = (mods_)->mods; \
+ (idx) < (mods_)->num_mods; \
+ (idx)++, (iter)++)
static inline const struct xkb_key *
XkbKey(struct xkb_keymap *keymap, xkb_keycode_t kc)