From: Daniel Stone Date: Mon, 20 Feb 2012 17:14:04 +0000 (+0000) Subject: Switch expression resolution priv from char to void X-Git-Tag: xkbcommon-0.2.0~765 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43ed3ff07047ec03a42eb7a1b49e37d1357054b7;p=platform%2Fupstream%2Flibxkbcommon.git Switch expression resolution priv from char to void Avoids a lot of really lame casts. Signed-off-by: Daniel Stone --- diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index 1d610a0..d175123 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -34,7 +34,7 @@ /***====================================================================***/ -typedef Bool(*IdentLookupFunc) (char * /* priv */ , +typedef Bool(*IdentLookupFunc) (void * /* priv */ , uint32_t /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ @@ -164,7 +164,7 @@ ExprResolveLhs(ExprDef * expr, } static Bool -SimpleLookup(char * priv, uint32_t field, unsigned type, +SimpleLookup(void * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) { LookupEntry *entry; @@ -176,8 +176,7 @@ SimpleLookup(char * priv, uint32_t field, unsigned type, return False; } str = XkbcAtomText(field); - for (entry = (LookupEntry *) priv; - (entry != NULL) && (entry->name != NULL); entry++) + for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++) { if (uStrCaseCmp(str, entry->name) == 0) { @@ -191,7 +190,7 @@ SimpleLookup(char * priv, uint32_t field, unsigned type, } static Bool -RadioLookup(char * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) +RadioLookup(void * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) { const char *str; int rg; @@ -231,14 +230,14 @@ static LookupEntry modIndexNames[] = { }; int -LookupModIndex(char * priv, uint32_t field, unsigned type, +LookupModIndex(void * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) { - return SimpleLookup((char *) modIndexNames, field, type, val_rtrn); + return SimpleLookup(modIndexNames, field, type, val_rtrn); } int -LookupModMask(char * priv, uint32_t field, unsigned type, +LookupModMask(void * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) { char *str; @@ -520,7 +519,7 @@ ExprResolveKeyCode(ExprDef * expr, static int ExprResolveIntegerLookup(ExprDef * expr, ExprResult * val_rtrn, - IdentLookupFunc lookup, char * lookupPriv) + IdentLookupFunc lookup, void * lookupPriv) { int ok = 0; ExprResult leftRtrn, rightRtrn; @@ -657,7 +656,7 @@ ExprResolveGroup(ExprDef * expr, }; return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup, - (char *) group_names); + group_names); } int @@ -677,7 +676,7 @@ ExprResolveLevel(ExprDef * expr, }; return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup, - (char *) level_names); + level_names); } int @@ -695,7 +694,7 @@ ExprResolveButton(ExprDef * expr, }; return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup, - (char *) button_names); + button_names); } int @@ -856,7 +855,7 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) exprOpText(expr->op)); return False; } - if (!SimpleLookup((char *) values, expr->value.str, TypeInt, val_rtrn)) + if (!SimpleLookup(values, expr->value.str, TypeInt, val_rtrn)) { int nOut = 0; ERROR("Illegal identifier %s (expected one of: ", @@ -880,7 +879,7 @@ static int ExprResolveMaskLookup(ExprDef * expr, ExprResult * val_rtrn, IdentLookupFunc lookup, - char * lookupPriv) + void * lookupPriv) { int ok = 0; ExprResult leftRtrn, rightRtrn; @@ -978,8 +977,7 @@ ExprResolveMask(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) { - return ExprResolveMaskLookup(expr, val_rtrn, SimpleLookup, - (char *) values); + return ExprResolveMaskLookup(expr, val_rtrn, SimpleLookup, values); } int @@ -994,8 +992,7 @@ ExprResolveVModMask(ExprDef * expr, ExprResult * val_rtrn, struct xkb_desc *xkb) { - return ExprResolveMaskLookup(expr, val_rtrn, LookupVModMask, - (char *) xkb); + return ExprResolveMaskLookup(expr, val_rtrn, LookupVModMask, xkb); } int diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h index feed902..46b89c8 100644 --- a/src/xkbcomp/expr.h +++ b/src/xkbcomp/expr.h @@ -51,19 +51,19 @@ typedef struct _LookupEntry extern char *exprOpText(unsigned /* type */ ); -extern int LookupModMask(char * /* priv */ , +extern int LookupModMask(void * /* priv */ , uint32_t /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int LookupVModMask(char * /* priv */ , +extern int LookupVModMask(void * /* priv */ , uint32_t /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int LookupModIndex(char * /* priv */ , +extern int LookupModIndex(void * /* priv */ , uint32_t /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index 31b0b4c..4ea022a 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -162,13 +162,11 @@ HandleVModDef(VModDef * stmt, struct xkb_desc *xkb, unsigned mergeMode, * undefined. */ static int -LookupVModIndex(char * priv, uint32_t field, unsigned type, +LookupVModIndex(struct xkb_desc *xkb, uint32_t field, unsigned type, ExprResult * val_rtrn) { int i; - struct xkb_desc * xkb; - xkb = (struct xkb_desc *) priv; if ((xkb == NULL) || (xkb->names == NULL) || (type != TypeInt)) { return False; @@ -200,7 +198,7 @@ LookupVModIndex(char * priv, uint32_t field, unsigned type, * undefined. */ int -LookupVModMask(char * priv, uint32_t field, unsigned type, +LookupVModMask(void * priv, uint32_t field, unsigned type, ExprResult * val_rtrn) { if (LookupModMask(NULL, field, type, val_rtrn)) @@ -223,7 +221,7 @@ FindKeypadVMod(struct xkb_desc * xkb) ExprResult rtrn; name = xkb_intern_atom("NumLock"); - if ((xkb) && LookupVModIndex((char *) xkb, name, TypeInt, &rtrn)) + if ((xkb) && LookupVModIndex(xkb, name, TypeInt, &rtrn)) { return rtrn.ival; } diff --git a/src/xkbcomp/vmod.h b/src/xkbcomp/vmod.h index 55de95c..ee95109 100644 --- a/src/xkbcomp/vmod.h +++ b/src/xkbcomp/vmod.h @@ -54,12 +54,6 @@ extern Bool ApplyVModDefs(VModInfo * /* info */ , struct xkb_desc * /* xkb */ ); -extern int LookupVModMask(char * /* priv */ , - uint32_t /* field */ , - unsigned /* type */ , - ExprResult * /* val_rtrn */ - ); - extern int FindKeypadVMod(struct xkb_desc * /* xkb */ );