From 091a0542ac0bbd8b49c669e7380fa61a1b3ca61c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 15 Jul 2012 14:24:54 +0300 Subject: [PATCH] Remove redundant keymap->keys resizes The size (i.e. max_keycode) is determined in the keycodes section, which gets compiled first. Signed-off-by: Ran Benita --- src/xkbcomp/misc.c | 2 -- src/xkbcomp/symbols.c | 17 +---------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c index bc1ab42..94a5e19 100644 --- a/src/xkbcomp/misc.c +++ b/src/xkbcomp/misc.c @@ -246,8 +246,6 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name, } if (create) { - darray_resize0(keymap->keys, keymap->max_key_code + 1); - /* Find first unused keycode and store our key here */ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) { key = XkbKey(keymap, kc); diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 4b64a82..f81c532 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -1880,18 +1880,6 @@ CopyModMapDef(struct xkb_keymap *keymap, ModMapEntry *entry) return true; } -static bool -InitKeymapForSymbols(struct xkb_keymap *keymap) -{ - size_t nKeys = keymap->max_key_code + 1; - - darray_resize0(keymap->keys, nKeys); - - darray_resize0(keymap->acts, darray_size(keymap->acts) + 32 + 1); - - return true; -} - /** * Handle the xkb_symbols section of an xkb file. * @@ -1904,7 +1892,6 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { int i; - bool ok; xkb_keycode_t kc; struct xkb_key *key; SymbolsInfo info; @@ -1921,9 +1908,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, if (info.errorCount != 0) goto err_info; - ok = InitKeymapForSymbols(keymap); - if (!ok) - goto err_info; + darray_resize0(keymap->acts, darray_size(keymap->acts) + 32 + 1); if (info.name) keymap->symbols_section_name = strdup(info.name);