Switch expression resolution priv from char to void
Avoids a lot of really lame casts. Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
eb6d9a0528
commit
43ed3ff070
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
typedef Bool(*IdentLookupFunc) (char * /* priv */ ,
|
typedef Bool(*IdentLookupFunc) (void * /* priv */ ,
|
||||||
uint32_t /* field */ ,
|
uint32_t /* field */ ,
|
||||||
unsigned /* type */ ,
|
unsigned /* type */ ,
|
||||||
ExprResult * /* val_rtrn */
|
ExprResult * /* val_rtrn */
|
||||||
|
@ -164,7 +164,7 @@ ExprResolveLhs(ExprDef * expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
SimpleLookup(char * priv, uint32_t field, unsigned type,
|
SimpleLookup(void * priv, uint32_t field, unsigned type,
|
||||||
ExprResult * val_rtrn)
|
ExprResult * val_rtrn)
|
||||||
{
|
{
|
||||||
LookupEntry *entry;
|
LookupEntry *entry;
|
||||||
|
@ -176,8 +176,7 @@ SimpleLookup(char * priv, uint32_t field, unsigned type,
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
str = XkbcAtomText(field);
|
str = XkbcAtomText(field);
|
||||||
for (entry = (LookupEntry *) priv;
|
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++)
|
||||||
(entry != NULL) && (entry->name != NULL); entry++)
|
|
||||||
{
|
{
|
||||||
if (uStrCaseCmp(str, entry->name) == 0)
|
if (uStrCaseCmp(str, entry->name) == 0)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +190,7 @@ SimpleLookup(char * priv, uint32_t field, unsigned type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
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;
|
const char *str;
|
||||||
int rg;
|
int rg;
|
||||||
|
@ -231,14 +230,14 @@ static LookupEntry modIndexNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
LookupModIndex(char * priv, uint32_t field, unsigned type,
|
LookupModIndex(void * priv, uint32_t field, unsigned type,
|
||||||
ExprResult * val_rtrn)
|
ExprResult * val_rtrn)
|
||||||
{
|
{
|
||||||
return SimpleLookup((char *) modIndexNames, field, type, val_rtrn);
|
return SimpleLookup(modIndexNames, field, type, val_rtrn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
LookupModMask(char * priv, uint32_t field, unsigned type,
|
LookupModMask(void * priv, uint32_t field, unsigned type,
|
||||||
ExprResult * val_rtrn)
|
ExprResult * val_rtrn)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -520,7 +519,7 @@ ExprResolveKeyCode(ExprDef * expr,
|
||||||
static int
|
static int
|
||||||
ExprResolveIntegerLookup(ExprDef * expr,
|
ExprResolveIntegerLookup(ExprDef * expr,
|
||||||
ExprResult * val_rtrn,
|
ExprResult * val_rtrn,
|
||||||
IdentLookupFunc lookup, char * lookupPriv)
|
IdentLookupFunc lookup, void * lookupPriv)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
|
@ -657,7 +656,7 @@ ExprResolveGroup(ExprDef * expr,
|
||||||
};
|
};
|
||||||
|
|
||||||
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
||||||
(char *) group_names);
|
group_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -677,7 +676,7 @@ ExprResolveLevel(ExprDef * expr,
|
||||||
};
|
};
|
||||||
|
|
||||||
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
||||||
(char *) level_names);
|
level_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -695,7 +694,7 @@ ExprResolveButton(ExprDef * expr,
|
||||||
};
|
};
|
||||||
|
|
||||||
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
|
||||||
(char *) button_names);
|
button_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -856,7 +855,7 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values)
|
||||||
exprOpText(expr->op));
|
exprOpText(expr->op));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
if (!SimpleLookup((char *) values, expr->value.str, TypeInt, val_rtrn))
|
if (!SimpleLookup(values, expr->value.str, TypeInt, val_rtrn))
|
||||||
{
|
{
|
||||||
int nOut = 0;
|
int nOut = 0;
|
||||||
ERROR("Illegal identifier %s (expected one of: ",
|
ERROR("Illegal identifier %s (expected one of: ",
|
||||||
|
@ -880,7 +879,7 @@ static int
|
||||||
ExprResolveMaskLookup(ExprDef * expr,
|
ExprResolveMaskLookup(ExprDef * expr,
|
||||||
ExprResult * val_rtrn,
|
ExprResult * val_rtrn,
|
||||||
IdentLookupFunc lookup,
|
IdentLookupFunc lookup,
|
||||||
char * lookupPriv)
|
void * lookupPriv)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
|
@ -978,8 +977,7 @@ ExprResolveMask(ExprDef * expr,
|
||||||
ExprResult * val_rtrn,
|
ExprResult * val_rtrn,
|
||||||
LookupEntry * values)
|
LookupEntry * values)
|
||||||
{
|
{
|
||||||
return ExprResolveMaskLookup(expr, val_rtrn, SimpleLookup,
|
return ExprResolveMaskLookup(expr, val_rtrn, SimpleLookup, values);
|
||||||
(char *) values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -994,8 +992,7 @@ ExprResolveVModMask(ExprDef * expr,
|
||||||
ExprResult * val_rtrn,
|
ExprResult * val_rtrn,
|
||||||
struct xkb_desc *xkb)
|
struct xkb_desc *xkb)
|
||||||
{
|
{
|
||||||
return ExprResolveMaskLookup(expr, val_rtrn, LookupVModMask,
|
return ExprResolveMaskLookup(expr, val_rtrn, LookupVModMask, xkb);
|
||||||
(char *) xkb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -51,19 +51,19 @@ typedef struct _LookupEntry
|
||||||
extern char *exprOpText(unsigned /* type */
|
extern char *exprOpText(unsigned /* type */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern int LookupModMask(char * /* priv */ ,
|
extern int LookupModMask(void * /* priv */ ,
|
||||||
uint32_t /* field */ ,
|
uint32_t /* field */ ,
|
||||||
unsigned /* type */ ,
|
unsigned /* type */ ,
|
||||||
ExprResult * /* val_rtrn */
|
ExprResult * /* val_rtrn */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern int LookupVModMask(char * /* priv */ ,
|
extern int LookupVModMask(void * /* priv */ ,
|
||||||
uint32_t /* field */ ,
|
uint32_t /* field */ ,
|
||||||
unsigned /* type */ ,
|
unsigned /* type */ ,
|
||||||
ExprResult * /* val_rtrn */
|
ExprResult * /* val_rtrn */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern int LookupModIndex(char * /* priv */ ,
|
extern int LookupModIndex(void * /* priv */ ,
|
||||||
uint32_t /* field */ ,
|
uint32_t /* field */ ,
|
||||||
unsigned /* type */ ,
|
unsigned /* type */ ,
|
||||||
ExprResult * /* val_rtrn */
|
ExprResult * /* val_rtrn */
|
||||||
|
|
|
@ -162,13 +162,11 @@ HandleVModDef(VModDef * stmt, struct xkb_desc *xkb, unsigned mergeMode,
|
||||||
* undefined.
|
* undefined.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
LookupVModIndex(char * priv, uint32_t field, unsigned type,
|
LookupVModIndex(struct xkb_desc *xkb, uint32_t field, unsigned type,
|
||||||
ExprResult * val_rtrn)
|
ExprResult * val_rtrn)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct xkb_desc * xkb;
|
|
||||||
|
|
||||||
xkb = (struct xkb_desc *) priv;
|
|
||||||
if ((xkb == NULL) || (xkb->names == NULL) || (type != TypeInt))
|
if ((xkb == NULL) || (xkb->names == NULL) || (type != TypeInt))
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
|
@ -200,7 +198,7 @@ LookupVModIndex(char * priv, uint32_t field, unsigned type,
|
||||||
* undefined.
|
* undefined.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
LookupVModMask(char * priv, uint32_t field, unsigned type,
|
LookupVModMask(void * priv, uint32_t field, unsigned type,
|
||||||
ExprResult * val_rtrn)
|
ExprResult * val_rtrn)
|
||||||
{
|
{
|
||||||
if (LookupModMask(NULL, field, type, val_rtrn))
|
if (LookupModMask(NULL, field, type, val_rtrn))
|
||||||
|
@ -223,7 +221,7 @@ FindKeypadVMod(struct xkb_desc * xkb)
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
|
|
||||||
name = xkb_intern_atom("NumLock");
|
name = xkb_intern_atom("NumLock");
|
||||||
if ((xkb) && LookupVModIndex((char *) xkb, name, TypeInt, &rtrn))
|
if ((xkb) && LookupVModIndex(xkb, name, TypeInt, &rtrn))
|
||||||
{
|
{
|
||||||
return rtrn.ival;
|
return rtrn.ival;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,6 @@ extern Bool ApplyVModDefs(VModInfo * /* info */ ,
|
||||||
struct xkb_desc * /* xkb */
|
struct xkb_desc * /* xkb */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern int LookupVModMask(char * /* priv */ ,
|
|
||||||
uint32_t /* field */ ,
|
|
||||||
unsigned /* type */ ,
|
|
||||||
ExprResult * /* val_rtrn */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern int FindKeypadVMod(struct xkb_desc * /* xkb */
|
extern int FindKeypadVMod(struct xkb_desc * /* xkb */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue