expr: drop ExprResult from ResolveKeysym 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
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index 2d71ca7..025010e 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -820,26 +820,24 @@ ExprResolveVModMask(struct xkb_keymap *keymap, ExprDef *expr,
keymap);
}
-int
+bool
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
- ExprResult *val_rtrn)
+ xkb_keysym_t *sym_rtrn)
{
- int ok = 0;
- xkb_keysym_t sym;
+ bool ok = false;
+ ExprResult result;
if (expr->op == EXPR_IDENT) {
const char *str;
str = xkb_atom_text(ctx, expr->value.str);
- if (str) {
- sym = xkb_keysym_from_name(str);
- if (sym != XKB_KEY_NoSymbol) {
- val_rtrn->uval = sym;
- return true;
- }
- }
+ *sym_rtrn = xkb_keysym_from_name(str);
+ if (*sym_rtrn != XKB_KEY_NoSymbol)
+ return true;
}
- ok = ExprResolveInteger(ctx, expr, val_rtrn);
- if ((ok) && (val_rtrn->uval < 10))
- val_rtrn->uval += '0';
+
+ ok = ExprResolveInteger(ctx, expr, &result);
+ if (ok && result.uval < 10)
+ *sym_rtrn = result.uval + '0';
+
return ok;
}
diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h
index 214ea8d..c5222a1 100644
--- a/src/xkbcomp/expr.h
+++ b/src/xkbcomp/expr.h
@@ -103,8 +103,8 @@ extern int
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
const LookupEntry *values);
-extern int
+bool
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
- ExprResult *val_rtrn);
+ xkb_keysym_t *sym_rtrn);
#endif /* EXPR_H */
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 06db89d..97a6543 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1370,13 +1370,15 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
ok = true;
tmp.modifier = rtrn.uval;
for (key = def->keys; key != NULL; key = (ExprDef *) key->common.next) {
+ xkb_keysym_t sym;
+
if (key->op == EXPR_VALUE && key->value_type == EXPR_TYPE_KEYNAME) {
tmp.haveSymbol = false;
tmp.u.keyName = KeyNameToLong(key->value.keyName);
}
- else if (ExprResolveKeySym(ctx, key, &rtrn)) {
+ else if (ExprResolveKeySym(ctx, key, &sym)) {
tmp.haveSymbol = true;
- tmp.u.keySym = rtrn.uval;
+ tmp.u.keySym = sym;
}
else {
log_err(info->keymap->ctx,