From: Ran Benita Date: Mon, 24 Sep 2012 12:57:30 +0000 (+0200) Subject: keymap: remove some more unneeded macros X-Git-Tag: xkbcommon-0.2.0~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d2659267aba6bddc8fd44306262720965007846;p=platform%2Fupstream%2Flibxkbcommon.git keymap: remove some more unneeded macros It clearer to just access the needed data directly. Signed-off-by: Ran Benita --- diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 695c3be..d2f9774 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -717,7 +717,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (level != 0) write_buf(buf, ", "); write_action(keymap, buf, - XkbKeyActionEntry(key, group, level), + &key->groups[group].levels[level].action, NULL, NULL); } write_buf(buf, " ]"); diff --git a/src/keymap.c b/src/keymap.c index 77afda7..bc2632f 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -321,11 +321,15 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, if (level >= XkbKeyGroupWidth(key, layout)) goto err; - num_syms = XkbKeyNumSyms(key, layout, level); + num_syms = key->groups[layout].levels[level].num_syms; if (num_syms == 0) goto err; - *syms_out = XkbKeySymEntry(key, layout, level); + if (num_syms == 1) + *syms_out = &key->groups[layout].levels[level].u.sym; + else + *syms_out = key->groups[layout].levels[level].u.syms; + return num_syms; err: diff --git a/src/keymap.h b/src/keymap.h index 0829c39..014ad72 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -413,30 +413,6 @@ XkbKeyGroupWidth(const struct xkb_key *key, xkb_layout_index_t layout) return key->groups[layout].type->num_levels; } -static inline unsigned int -XkbKeyNumSyms(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - return key->groups[layout].levels[level].num_syms; -} - -static inline const xkb_keysym_t * -XkbKeySymEntry(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - if (XkbKeyNumSyms(key, layout, level) <= 1) - return &key->groups[layout].levels[level].u.sym; - else - return key->groups[layout].levels[level].u.syms; -} - -static inline const union xkb_action * -XkbKeyActionEntry(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - return &key->groups[layout].levels[level].action; -} - struct xkb_keymap * xkb_keymap_new(struct xkb_context *ctx, enum xkb_keymap_format format, diff --git a/src/state.c b/src/state.c index 0210d38..9fa57ff 100644 --- a/src/state.c +++ b/src/state.c @@ -218,7 +218,7 @@ xkb_key_get_action(struct xkb_state *state, const struct xkb_key *key) if (level == XKB_LEVEL_INVALID) return &fake; - return XkbKeyActionEntry(key, layout, level); + return &key->groups[layout].levels[level].action; } static struct xkb_filter * diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 13c0887..9a96487 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -1308,10 +1308,9 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) xkb_foreach_key(key, keymap) { for (group = 0; group < key->num_groups; group++) { - for (level = 0; level < XkbKeyGroupWidth(key, group); - level++) { - if (XkbKeyNumSyms(key, group, level) != 1 || - (XkbKeySymEntry(key, group, level))[0] != sym) + for (level = 0; level < XkbKeyGroupWidth(key, group); level++) { + if (key->groups[group].levels[level].num_syms != 1 || + key->groups[group].levels[level].u.sym != sym) continue; /*