symbols: remove unneeded recursion form CopySymbolsDef This function does some funky stuff, which, as far as I can tell, was needed to support the functionality of giving different keycodes the same name and thus make them duplicates (MERGE_ALT_FORM). This stuff was removed as useless in 0765064b3, but this leftover wasn't noticed. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 3752c1d..c00f8bf 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -422,11 +422,8 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, struct xkb_key *key)
return (xkb_keycode_t)(key - keymap->keys.item);
}
-#define xkb_foreach_key_from(iter, keymap, from) \
- darray_foreach_from(iter, keymap->keys, from)
-
#define xkb_foreach_key(iter, keymap) \
- xkb_foreach_key_from(iter, keymap, keymap->min_key_code)
+ darray_foreach(iter, keymap->keys)
static inline struct xkb_key_type *
XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key,
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 454b6f3..274959b 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -754,7 +754,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
darray_foreach(alias, info->aliases) {
/* Check that ->real is a key. */
- key = FindNamedKey(keymap, alias->real, false, 0);
+ key = FindNamedKey(keymap, alias->real, false);
if (!key) {
log_vrb(info->ctx, 5,
"Attempt to alias %s to non-existent key %s; Ignored\n",
@@ -764,7 +764,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
}
/* Check that ->alias is not a key. */
- key = FindNamedKey(keymap, alias->alias, false, 0);
+ key = FindNamedKey(keymap, alias->alias, false);
if (key) {
log_vrb(info->ctx, 5,
"Attempt to create alias with the name of a real key; "
@@ -859,24 +859,18 @@ err_info:
}
struct xkb_key *
-FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
- bool use_aliases, xkb_keycode_t start_from)
+FindNamedKey(struct xkb_keymap *keymap, unsigned long name, bool use_aliases)
{
struct xkb_key *key;
- if (start_from < keymap->min_key_code)
- start_from = keymap->min_key_code;
- else if (start_from > keymap->max_key_code)
- return NULL;
-
- xkb_foreach_key_from(key, keymap, start_from)
+ xkb_foreach_key(key, keymap)
if (KeyNameToLong(key->name) == name)
return key;
if (use_aliases) {
unsigned long new_name;
if (FindKeyNameForAlias(keymap, name, &new_name))
- return FindNamedKey(keymap, new_name, false, 0);
+ return FindNamedKey(keymap, new_name, false);
}
return NULL;
diff --git a/src/xkbcomp/keycodes.h b/src/xkbcomp/keycodes.h
index d95e16a..41bd18c 100644
--- a/src/xkbcomp/keycodes.h
+++ b/src/xkbcomp/keycodes.h
@@ -56,7 +56,7 @@ LongKeyNameText(unsigned long val)
struct xkb_key *
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
- bool use_aliases, xkb_keycode_t start_from);
+ bool use_aliases);
bool
FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index fe6511d..a9879ec 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1490,14 +1490,8 @@ PrepareKeyDef(KeyInfo *keyi)
ClearGroupInfo(&keyi->groups[i]);
}
-/**
- * Copy the KeyInfo into the keyboard description.
- *
- * This function recurses.
- */
static bool
-CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
- xkb_keycode_t start_from)
+CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
{
struct xkb_keymap *keymap = info->keymap;
xkb_keycode_t kc;
@@ -1506,18 +1500,15 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
xkb_group_index_t i, nGroups;
xkb_level_index_t width, tmp;
struct xkb_key_type * type;
- bool haveActions, autoType, useAlias;
+ bool haveActions, autoType;
unsigned types[XKB_NUM_GROUPS];
unsigned int symIndex = 0;
- useAlias = (start_from == 0);
-
- key = FindNamedKey(keymap, keyi->name, useAlias, start_from);
+ key = FindNamedKey(keymap, keyi->name, true);
if (!key) {
- if (start_from == 0)
- log_vrb(info->keymap->ctx, 5,
- "Key %s not found in keycodes; Symbols ignored\n",
- LongKeyNameText(keyi->name));
+ log_vrb(info->keymap->ctx, 5,
+ "Key %s not found in keycodes; Symbols ignored\n",
+ LongKeyNameText(keyi->name));
return false;
}
kc = XkbKeyGetKeycode(keymap, key);
@@ -1657,8 +1648,6 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
key->explicit |= EXPLICIT_REPEAT;
}
- /* do the same thing for the next key */
- CopySymbolsDef(info, keyi, kc + 1);
return true;
}
@@ -1669,7 +1658,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
struct xkb_keymap *keymap = info->keymap;
if (!entry->haveSymbol) {
- key = FindNamedKey(keymap, entry->u.keyName, true, 0);
+ key = FindNamedKey(keymap, entry->u.keyName, true);
if (!key) {
log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; "
@@ -1741,7 +1730,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
/* copy! */
darray_foreach(keyi, info.keys)
- if (!CopySymbolsDef(&info, keyi, 0))
+ if (!CopySymbolsDef(&info, keyi))
info.errorCount++;
if (xkb_get_log_verbosity(keymap->ctx) > 3) {