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 <ran234@gmail.com>
master
Ran Benita 2012-07-23 11:56:13 +03:00
parent 01c81fa61e
commit 761b675cc3
3 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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,