Commit 7a90f9e2256ff502342f52ad65b7bf007fd5e047

Ran Benita 2012-09-23T20:36:01

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>

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;