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 <ran234@gmail.com>
master
Ran Benita 2012-07-15 14:24:54 +03:00
parent ad8875c526
commit 091a0542ac
2 changed files with 1 additions and 18 deletions

View File

@ -246,8 +246,6 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
} }
if (create) { if (create) {
darray_resize0(keymap->keys, keymap->max_key_code + 1);
/* Find first unused keycode and store our key here */ /* Find first unused keycode and store our key here */
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) { for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
key = XkbKey(keymap, kc); key = XkbKey(keymap, kc);

View File

@ -1880,18 +1880,6 @@ CopyModMapDef(struct xkb_keymap *keymap, ModMapEntry *entry)
return true; 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. * Handle the xkb_symbols section of an xkb file.
* *
@ -1904,7 +1892,6 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
enum merge_mode merge) enum merge_mode merge)
{ {
int i; int i;
bool ok;
xkb_keycode_t kc; xkb_keycode_t kc;
struct xkb_key *key; struct xkb_key *key;
SymbolsInfo info; SymbolsInfo info;
@ -1921,9 +1908,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
if (info.errorCount != 0) if (info.errorCount != 0)
goto err_info; goto err_info;
ok = InitKeymapForSymbols(keymap); darray_resize0(keymap->acts, darray_size(keymap->acts) + 32 + 1);
if (!ok)
goto err_info;
if (info.name) if (info.name)
keymap->symbols_section_name = strdup(info.name); keymap->symbols_section_name = strdup(info.name);