From 6db8fd556e2562e9a0a821c0d6fd4f7cdcf6266c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 11 Dec 2022 15:18:26 -0800 Subject: Mark more pointers as const Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith --- keytypes.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'keytypes.c') diff --git a/keytypes.c b/keytypes.c index 24ad6b1..fcf87e0 100644 --- a/keytypes.c +++ b/keytypes.c @@ -105,7 +105,7 @@ Atom tok_KEYPAD; /***====================================================================***/ static void -InitKeyTypesInfo(KeyTypesInfo * info, XkbDescPtr xkb, KeyTypesInfo * from) +InitKeyTypesInfo(KeyTypesInfo *info, XkbDescPtr xkb, const KeyTypesInfo *from) { tok_ONE_LEVEL = XkbInternAtom(NULL, "ONE_LEVEL", False); tok_TWO_LEVEL = XkbInternAtom(NULL, "TWO_LEVEL", False); @@ -232,7 +232,7 @@ NextKeyType(KeyTypesInfo * info) } static KeyTypeInfo * -FindMatchingKeyType(KeyTypesInfo * info, KeyTypeInfo * new) +FindMatchingKeyType(KeyTypesInfo *info, const KeyTypeInfo *new) { for (KeyTypeInfo *old = info->types; old; old = (KeyTypeInfo *) old->defs.next) @@ -445,7 +445,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt, /***====================================================================***/ static XkbKTMapEntryPtr -FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask) +FindMatchingMapEntry(const KeyTypeInfo *type, unsigned mask, unsigned vmask) { int i; XkbKTMapEntryPtr entry; @@ -648,8 +648,8 @@ static LookupEntry lnames[] = { }; static Bool -SetMapEntry(KeyTypeInfo * type, - XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) +SetMapEntry(KeyTypeInfo *type, XkbDescPtr xkb, + const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; XkbKTMapEntryRec entry; @@ -695,8 +695,8 @@ SetMapEntry(KeyTypeInfo * type, } static Bool -SetPreserve(KeyTypeInfo * type, - XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) +SetPreserve(KeyTypeInfo *type, XkbDescPtr xkb, + const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; PreserveInfo new; @@ -805,7 +805,7 @@ AddLevelName(KeyTypeInfo * type, } static Bool -SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) +SetLevelName(KeyTypeInfo *type, const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; unsigned level; @@ -844,10 +844,9 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) * @param field The field to parse (e.g. modifiers, map, level_name) */ static Bool -SetKeyTypeField(KeyTypeInfo * type, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, KeyTypesInfo * info) +SetKeyTypeField(KeyTypeInfo * type, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + KeyTypesInfo *info) { if (uStrCaseCmp(field, "modifiers") == 0) { @@ -904,7 +903,7 @@ SetKeyTypeField(KeyTypeInfo * type, } static Bool -HandleKeyTypeVar(VarDef * stmt, XkbDescPtr xkb, KeyTypesInfo * info) +HandleKeyTypeVar(const VarDef *stmt, XkbDescPtr xkb, KeyTypesInfo *info) { ExprResult elem, field; ExprDef *arrayNdx; @@ -929,8 +928,8 @@ HandleKeyTypeVar(VarDef * stmt, XkbDescPtr xkb, KeyTypesInfo * info) } static int -HandleKeyTypeBody(VarDef * def, - XkbDescPtr xkb, KeyTypeInfo * type, KeyTypesInfo * info) +HandleKeyTypeBody(const VarDef *def, XkbDescPtr xkb, + KeyTypeInfo *type, KeyTypesInfo *info) { int ok = 1; ExprResult tmp, field; @@ -956,8 +955,8 @@ HandleKeyTypeBody(VarDef * def, * */ static int -HandleKeyTypeDef(KeyTypeDef * def, - XkbDescPtr xkb, unsigned merge, KeyTypesInfo * info) +HandleKeyTypeDef(const KeyTypeDef *def, + XkbDescPtr xkb, unsigned merge, KeyTypesInfo *info) { KeyTypeInfo type = { .defs.defined = 0, -- cgit v1.2.3