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 /action.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 'action.c')
-rw-r--r-- | action.c | 115 |
1 files changed, 47 insertions, 68 deletions
@@ -335,16 +335,15 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad) } static Bool -HandleNoAction(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleNoAction(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { return ReportIllegal(action->type, field); } static Bool -CheckLatchLockFlags(unsigned action, - unsigned field, ExprDef * value, unsigned *flags_inout) +CheckLatchLockFlags(unsigned action, unsigned field, + const ExprDef *value, unsigned *flags_inout) { unsigned tmp; ExprResult result; @@ -365,9 +364,7 @@ CheckLatchLockFlags(unsigned action, } static Bool -CheckModifierField(XkbDescPtr xkb, - unsigned action, - ExprDef * value, +CheckModifierField(XkbDescPtr xkb, unsigned action, const ExprDef *value, unsigned *flags_inout, unsigned *mods_rtrn) { ExprResult rtrn; @@ -393,9 +390,8 @@ CheckModifierField(XkbDescPtr xkb, } static Bool -HandleSetLatchMods(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLatchMods(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbModAction *act; @@ -449,9 +445,8 @@ static LookupEntry lockWhich[] = { }; static Bool -HandleLockMods(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleLockMods(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbModAction *act; @@ -499,10 +494,10 @@ static LookupEntry groupNames[] = { }; static Bool -CheckGroupField(unsigned action, - ExprDef * value, unsigned *flags_inout, int *grp_rtrn) +CheckGroupField(unsigned action, const ExprDef *value, + unsigned *flags_inout, int *grp_rtrn) { - ExprDef *spec; + const ExprDef *spec; ExprResult rtrn; if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -536,9 +531,8 @@ CheckGroupField(unsigned action, } static Bool -HandleSetLatchGroup(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLatchGroup(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbGroupAction *act; @@ -583,9 +577,8 @@ HandleSetLatchGroup(XkbDescPtr xkb, } static Bool -HandleLockGroup(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleLockGroup(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef * array_ndx, const ExprDef *value) { XkbGroupAction *act; @@ -608,9 +601,8 @@ HandleLockGroup(XkbDescPtr xkb, } static Bool -HandleMovePtr(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleMovePtr(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrAction *act; @@ -667,9 +659,8 @@ static LookupEntry btnNames[] = { }; static Bool -HandlePtrBtn(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandlePtrBtn(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrBtnAction *act; @@ -729,9 +720,8 @@ static LookupEntry ptrDflts[] = { }; static Bool -HandleSetPtrDflt(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetPtrDflt(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrDfltAction *act; @@ -748,7 +738,7 @@ HandleSetPtrDflt(XkbDescPtr xkb, } else if ((field == F_Button) || (field == F_Value)) { - ExprDef *btn; + const ExprDef *btn; if (array_ndx != NULL) return ReportActionNotArray(action->type, field); if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -806,9 +796,8 @@ static LookupEntry isoNames[] = { }; static Bool -HandleISOLock(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleISOLock(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbISOAction *act; @@ -861,9 +850,8 @@ HandleISOLock(XkbDescPtr xkb, } static Bool -HandleSwitchScreen(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSwitchScreen(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbSwitchScreenAction *act; @@ -871,7 +859,7 @@ HandleSwitchScreen(XkbDescPtr xkb, act = (XkbSwitchScreenAction *) action; if (field == F_Screen) { - ExprDef *scrn; + const ExprDef *scrn; if (array_ndx != NULL) return ReportActionNotArray(action->type, field); if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -953,9 +941,8 @@ LookupEntry ctrlNames[] = { }; static Bool -HandleSetLockControls(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLockControls(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbCtrlsAction *act; @@ -994,9 +981,8 @@ static LookupEntry evNames[] = { }; static Bool -HandleActionMessage(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleActionMessage(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbMessageAction *act; @@ -1072,9 +1058,8 @@ HandleActionMessage(XkbDescPtr xkb, } static Bool -HandleRedirectKey(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleRedirectKey(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbRedirectKeyAction *act; @@ -1136,9 +1121,8 @@ HandleRedirectKey(XkbDescPtr xkb, } static Bool -HandleDeviceBtn(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleDeviceBtn(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbDeviceBtnAction *act; @@ -1206,9 +1190,8 @@ HandleDeviceBtn(XkbDescPtr xkb, } static Bool -HandleDeviceValuator(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleDeviceValuator(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { #if 0 ExprResult rtrn; @@ -1221,9 +1204,8 @@ HandleDeviceValuator(XkbDescPtr xkb, } static Bool -HandlePrivate(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandlePrivate(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; @@ -1292,8 +1274,8 @@ HandlePrivate(XkbDescPtr xkb, typedef Bool(*actionHandler) (XkbDescPtr /* xkb */ , XkbAnyAction * /* action */ , unsigned /* field */ , - ExprDef * /* array_ndx */ , - ExprDef * /* value */ + const ExprDef * /* array_ndx */ , + const ExprDef * /* value */ ); static actionHandler handleAction[XkbSA_NumActions + 1] = { @@ -1341,12 +1323,11 @@ ApplyActionFactoryDefaults(XkbAction * action) int -HandleActionDef(ExprDef * def, - XkbDescPtr xkb, - XkbAnyAction * action, unsigned mergeMode, ActionInfo * info) +HandleActionDef(const ExprDef *def, XkbDescPtr xkb, XkbAnyAction *action, + unsigned mergeMode, const ActionInfo *info) { ExprDef *arg; - char *str; + const char *str; unsigned tmp, hndlrType; if (!actionsInitialized) @@ -1441,10 +1422,8 @@ HandleActionDef(ExprDef * def, /***====================================================================***/ int -SetActionField(XkbDescPtr xkb, - const char *elem, - const char *field, - ExprDef * array_ndx, ExprDef * value, ActionInfo ** info_rtrn) +SetActionField(XkbDescPtr xkb, const char *elem, const char *field, + ExprDef *array_ndx, ExprDef *value, ActionInfo **info_rtrn) { ActionInfo *new, *old; |