diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-11 15:18:26 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-01-03 11:02:11 -0800 |
commit | 6db8fd556e2562e9a0a821c0d6fd4f7cdcf6266c (patch) | |
tree | 45171678d6b1fbfe936bb2586933d3e03c93500a /expr.c | |
parent | 299c9762b1dbe53f3297c54e5526aeae767d1a10 (diff) |
Mark more pointers as const
Some suggested by cppcheck, others by manual code inspection
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'expr.c')
-rw-r--r-- | expr.c | 54 |
1 files changed, 23 insertions, 31 deletions
@@ -127,9 +127,8 @@ exprTypeText(unsigned type) } int -ExprResolveLhs(ExprDef * expr, - ExprResult * elem_rtrn, - ExprResult * field_rtrn, ExprDef ** index_rtrn) +ExprResolveLhs(const ExprDef *expr, ExprResult *elem_rtrn, + ExprResult *field_rtrn, ExprDef **index_rtrn) { switch (expr->op) { @@ -154,8 +153,8 @@ ExprResolveLhs(ExprDef * expr, } Bool -SimpleLookup(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +SimpleLookup(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { char *str; @@ -166,7 +165,7 @@ SimpleLookup(XPointer priv, return False; } str = XkbAtomGetString(NULL, field); - for (LookupEntry *entry = (LookupEntry *) priv; + for (const LookupEntry *entry = (const LookupEntry *) priv; (entry != NULL) && (entry->name != NULL); entry++) { if (uStrCaseCmp(str, entry->name) == 0) @@ -181,8 +180,8 @@ SimpleLookup(XPointer priv, } Bool -RadioLookup(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +RadioLookup(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { char *str; int rg; @@ -249,9 +248,9 @@ static LookupEntry modIndexNames[] = { {NULL, 0} }; -int -LookupModIndex(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +Bool +LookupModIndex(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { return SimpleLookup((XPointer) modIndexNames, elem, field, type, val_rtrn); @@ -289,7 +288,7 @@ LookupModMask(XPointer priv, #if 0 int -ExprResolveModIndex(ExprDef * expr, +ExprResolveModIndex(const ExprDef *expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { @@ -367,8 +366,7 @@ ExprResolveModIndex(ExprDef * expr, #endif int -ExprResolveModMask(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveModMask(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { LookupPriv priv = { @@ -381,8 +379,7 @@ ExprResolveModMask(ExprDef * expr, } int -ExprResolveBoolean(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveBoolean(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -478,8 +475,7 @@ ExprResolveBoolean(ExprDef * expr, } int -ExprResolveFloat(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveFloat(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -591,8 +587,7 @@ ExprResolveFloat(ExprDef * expr, } int -ExprResolveInteger(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveInteger(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -712,8 +707,7 @@ ExprResolveInteger(ExprDef * expr, } int -ExprResolveString(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveString(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -828,8 +822,7 @@ ExprResolveString(ExprDef * expr, } int -ExprResolveKeyName(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveKeyName(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -918,7 +911,8 @@ ExprResolveKeyName(ExprDef * expr, /***====================================================================***/ int -ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) +ExprResolveEnum(const ExprDef *expr, ExprResult *val_rtrn, + const LookupEntry *values) { if (expr->op != ExprIdent) { @@ -948,13 +942,12 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) } int -ExprResolveMask(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveMask(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; ExprResult leftRtrn, rightRtrn; - ExprDef *left, *right; + const ExprDef *left, *right; const char *bogus = NULL; switch (expr->op) @@ -1057,15 +1050,14 @@ ExprResolveMask(ExprDef * expr, } int -ExprResolveKeySym(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveKeySym(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; if (expr->op == ExprIdent) { - char *str; + const char *str; KeySym sym; str = XkbAtomGetString(NULL, expr->value.str); |