symbols: make xkb_key::syms a plain array
It's never resized. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
ee3ade3924
commit
ca87031861
|
@ -92,7 +92,7 @@ xkb_map_unref(struct xkb_keymap *keymap)
|
||||||
darray_foreach(key, keymap->keys) {
|
darray_foreach(key, keymap->keys) {
|
||||||
free(key->sym_index);
|
free(key->sym_index);
|
||||||
free(key->num_syms);
|
free(key->num_syms);
|
||||||
darray_free(key->syms);
|
free(key->syms);
|
||||||
free(key->actions);
|
free(key->actions);
|
||||||
}
|
}
|
||||||
darray_free(keymap->keys);
|
darray_free(keymap->keys);
|
||||||
|
|
|
@ -368,7 +368,7 @@ struct xkb_key {
|
||||||
int *sym_index;
|
int *sym_index;
|
||||||
/* per level/group */
|
/* per level/group */
|
||||||
unsigned int *num_syms;
|
unsigned int *num_syms;
|
||||||
darray(xkb_keysym_t) syms;
|
xkb_keysym_t *syms;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Common keyboard description structure */
|
/* Common keyboard description structure */
|
||||||
|
@ -453,8 +453,7 @@ static inline xkb_keysym_t *
|
||||||
XkbKeySymEntry(struct xkb_key *key, xkb_group_index_t group,
|
XkbKeySymEntry(struct xkb_key *key, xkb_group_index_t group,
|
||||||
xkb_level_index_t level)
|
xkb_level_index_t level)
|
||||||
{
|
{
|
||||||
return &darray_item(key->syms,
|
return &key->syms[key->sym_index[group * key->width + level]];
|
||||||
key->sym_index[group * key->width + level]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline union xkb_action *
|
static inline union xkb_action *
|
||||||
|
|
|
@ -1770,14 +1770,10 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
||||||
sizeSyms += darray_size(groupi->syms);
|
sizeSyms += darray_size(groupi->syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
darray_resize0(key->syms, sizeSyms);
|
key->syms = calloc(sizeSyms, sizeof(*key->syms));
|
||||||
|
|
||||||
key->num_groups = nGroups;
|
key->num_groups = nGroups;
|
||||||
|
|
||||||
key->width = width;
|
key->width = width;
|
||||||
|
|
||||||
key->sym_index = calloc(nGroups * width, sizeof(*key->sym_index));
|
key->sym_index = calloc(nGroups * width, sizeof(*key->sym_index));
|
||||||
|
|
||||||
key->num_syms = calloc(nGroups * width, sizeof(*key->num_syms));
|
key->num_syms = calloc(nGroups * width, sizeof(*key->num_syms));
|
||||||
|
|
||||||
if (haveActions) {
|
if (haveActions) {
|
||||||
|
@ -1806,7 +1802,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
||||||
for (tmp = 0; tmp < width; tmp++) {
|
for (tmp = 0; tmp < width; tmp++) {
|
||||||
if (tmp < groupi->numLevels &&
|
if (tmp < groupi->numLevels &&
|
||||||
darray_item(groupi->symsMapNumEntries, tmp) != 0) {
|
darray_item(groupi->symsMapNumEntries, tmp) != 0) {
|
||||||
memcpy(darray_mem(key->syms, symIndex),
|
memcpy(&key->syms[symIndex],
|
||||||
darray_mem(groupi->syms,
|
darray_mem(groupi->syms,
|
||||||
darray_item(groupi->symsMapIndex, tmp)),
|
darray_item(groupi->symsMapIndex, tmp)),
|
||||||
darray_item(groupi->symsMapNumEntries, tmp) * sizeof(xkb_keysym_t));
|
darray_item(groupi->symsMapNumEntries, tmp) * sizeof(xkb_keysym_t));
|
||||||
|
|
Loading…
Reference in New Issue