symbols: remove useless identical groups optimization What this code does is, in case someone compile a keymap like -layout 'us,us,us' then only one group would be created. If there is anything which differentiates between any of the groups (e.g. a variant, another layout), then this is not done. This is pretty obscure, only saves a few kbytes in the final keymap, and if the user asked for it, why not let her? 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 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index e30589b..2f4c9f8 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1398,7 +1398,7 @@ FindAutomaticType(struct xkb_context *ctx, xkb_level_index_t width,
/**
* Ensure the given KeyInfo is in a coherent state, i.e. no gaps between the
- * groups, and reduce to one group if all groups are identical anyway.
+ * groups.
*/
static void
PrepareKeyDef(KeyInfo *keyi)
@@ -1431,36 +1431,6 @@ PrepareKeyDef(KeyInfo *keyi)
darray_copy(groupi->levels, group0->levels);
groupi->defined = group0->defined;
}
-
- /* If all groups are completely identical remove them all */
- /* exept the first one. */
- /* XXX: This code needs testing... or removal. */
- for (i = 1; i <= lastGroup; i++) {
- GroupInfo *groupi = &keyi->groups[i];
-
- if (groupi->type != group0->type)
- break;
-
- if (!darray_same(groupi->levels, group0->levels) &&
- (darray_empty(groupi->levels) || darray_empty(group0->levels) ||
- darray_size(groupi->levels) != darray_size(group0->levels) ||
- memcmp(darray_mem(groupi->levels, 0),
- darray_mem(group0->levels, 0),
- darray_size(group0->levels) * sizeof(LevelInfo))))
- break;
-
- if (!darray_same(groupi->syms, group0->syms) &&
- (darray_empty(groupi->syms) || darray_empty(group0->syms) ||
- darray_size(groupi->syms) != darray_size(group0->syms) ||
- memcmp(darray_mem(groupi->syms, 0),
- darray_mem(group0->syms, 0),
- darray_size(group0->syms) * sizeof(xkb_keysym_t))))
- break;
- }
-
- if (i > lastGroup)
- for (i = 1; i <= lastGroup; i++)
- ClearGroupInfo(&keyi->groups[i]);
}
static bool