keymap: don't use XKB_NUM_GROUPS for key->kt_index One unneeded XKB_NUM_GROUPS less. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/src/keymap.c b/src/keymap.c
index 13ad829..43e43dd 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -99,6 +99,7 @@ xkb_keymap_unref(struct xkb_keymap *keymap)
free(key->num_syms);
free(key->syms);
free(key->actions);
+ free(key->kt_index);
}
darray_free(keymap->keys);
darray_free(keymap->sym_interpret);
diff --git a/src/keymap.h b/src/keymap.h
index 2f1e42e..af47e4b 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -320,7 +320,7 @@ struct xkb_key {
union xkb_action *actions;
- unsigned kt_index[XKB_NUM_GROUPS];
+ unsigned *kt_index;
xkb_layout_index_t num_groups;
/* How many levels the largest group has. */
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index f92f8a6..e5fc7c1 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1500,6 +1500,7 @@ out_of_loops:
* Find and assign the groups' types in the keymap. Also find the
* key width according to the largest type.
*/
+ key->kt_index = calloc(key->num_groups, sizeof(*key->kt_index));
key->width = 0;
darray_enumerate(i, groupi, keyi->groups) {
struct xkb_key_type *type;