From: Ran Benita Date: Tue, 11 Sep 2012 13:14:16 +0000 (+0300) Subject: symbols: make xkb_key::syms a plain array X-Git-Tag: xkbcommon-0.2.0~160 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca87031861651fc4042b6a12cd5bc6f88447b189;p=platform%2Fupstream%2Flibxkbcommon.git symbols: make xkb_key::syms a plain array It's never resized. Signed-off-by: Ran Benita --- diff --git a/src/map.c b/src/map.c index 0c86bcb..2f115dc 100644 --- a/src/map.c +++ b/src/map.c @@ -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); diff --git a/src/xkb-priv.h b/src/xkb-priv.h index 321d1de..3752c1d 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -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 * diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 3ba10a1..0a4b061 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -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));