From 761b675cc3eaf34bb5b75a3f459e328b330bb551 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 23 Jul 2012 11:56:13 +0300 Subject: [PATCH] expr: drop ExprResult from ResolveKeyName Explicit is better than implicit, and this union makes it hard to follow what's what, particularly the confusion with ival/uval. The other Resolve functions will follow. Signed-off-by: Ran Benita --- src/xkbcomp/action.c | 8 ++++---- src/xkbcomp/expr.c | 6 +++--- src/xkbcomp/expr.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 276129c..ab836c4 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -824,12 +824,12 @@ static bool HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, unsigned field, ExprDef *array_ndx, ExprDef *value) { - ExprResult rtrn; struct xkb_key *key; struct xkb_redirect_key_action *act; unsigned t1; xkb_mod_mask_t t2; unsigned long tmp; + char key_name[XkbKeyNameLength]; if (array_ndx != NULL) return ReportActionNotArray(keymap, action->type, field); @@ -837,14 +837,14 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, act = (struct xkb_redirect_key_action *) action; switch (field) { case F_Keycode: - if (!ExprResolveKeyName(keymap->ctx, value, &rtrn)) + if (!ExprResolveKeyName(keymap->ctx, value, key_name)) return ReportMismatch(keymap, action->type, field, "key name"); - tmp = KeyNameToLong(rtrn.name); + tmp = KeyNameToLong(key_name); key = FindNamedKey(keymap, tmp, true, CreateKeyNames(keymap), 0); if (!key) return ReportNotFound(keymap, action->type, field, "Key", - KeyNameText(rtrn.name)); + KeyNameText(key_name)); act->new_kc = XkbKeyGetKeycode(keymap, key); return true; diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index f4d77f5..f5f3657 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -619,9 +619,9 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr, return false; } -int +bool ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr, - ExprResult *val_rtrn) + char name[XkbKeyNameLength]) { switch (expr->op) { case EXPR_VALUE: @@ -630,7 +630,7 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr, exprValueTypeText(expr->value_type)); return false; } - memcpy(val_rtrn->name, expr->value.keyName, XkbKeyNameLength); + memcpy(name, expr->value.keyName, XkbKeyNameLength); return true; case EXPR_IDENT: diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h index 174c1c8..549998b 100644 --- a/src/xkbcomp/expr.h +++ b/src/xkbcomp/expr.h @@ -95,9 +95,9 @@ extern int ExprResolveString(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn); -extern int +bool ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr, - ExprResult *val_rtrn); + char name[XkbKeyNameLength]); extern int ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn, -- 2.7.4