symbols: make xkb_key::syms a plain array

It's never resized.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-09-11 16:14:16 +03:00
parent ee3ade3924
commit ca87031861
3 changed files with 5 additions and 10 deletions

View File

@ -92,7 +92,7 @@ xkb_map_unref(struct xkb_keymap *keymap)
darray_foreach(key, keymap->keys) {
free(key->sym_index);
free(key->num_syms);
darray_free(key->syms);
free(key->syms);
free(key->actions);
}
darray_free(keymap->keys);

View File

@ -368,7 +368,7 @@ struct xkb_key {
int *sym_index;
/* per level/group */
unsigned int *num_syms;
darray(xkb_keysym_t) syms;
xkb_keysym_t *syms;
};
/* Common keyboard description structure */
@ -453,8 +453,7 @@ static inline xkb_keysym_t *
XkbKeySymEntry(struct xkb_key *key, xkb_group_index_t group,
xkb_level_index_t level)
{
return &darray_item(key->syms,
key->sym_index[group * key->width + level]);
return &key->syms[key->sym_index[group * key->width + level]];
}
static inline union xkb_action *

View File

@ -1770,14 +1770,10 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
sizeSyms += darray_size(groupi->syms);
}
darray_resize0(key->syms, sizeSyms);
key->syms = calloc(sizeSyms, sizeof(*key->syms));
key->num_groups = nGroups;
key->width = width;
key->sym_index = calloc(nGroups * width, sizeof(*key->sym_index));
key->num_syms = calloc(nGroups * width, sizeof(*key->num_syms));
if (haveActions) {
@ -1806,7 +1802,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
for (tmp = 0; tmp < width; tmp++) {
if (tmp < groupi->numLevels &&
darray_item(groupi->symsMapNumEntries, tmp) != 0) {
memcpy(darray_mem(key->syms, symIndex),
memcpy(&key->syms[symIndex],
darray_mem(groupi->syms,
darray_item(groupi->symsMapIndex, tmp)),
darray_item(groupi->symsMapNumEntries, tmp) * sizeof(xkb_keysym_t));