diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 11:11:00 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 11:35:53 -0700 |
commit | 199b00b2bbaf2dd90d95e9e3a77c738269ed3804 (patch) | |
tree | b6f9803b332c79c61ef315fe5088e036cfb33b50 | |
parent | fa4be31580f5ea62556ac02dc2e07737a758de87 (diff) |
Variable scope reduction as suggested by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | cfgscan.c | 5 | ||||
-rw-r--r-- | xkbevd.c | 10 |
2 files changed, 7 insertions, 8 deletions
@@ -341,8 +341,7 @@ static int numKeywords = sizeof(keywords) / sizeof(struct _Keyword); static int yyGetIdent(int first) { - int ch, i, found; - + int ch, found; int rtrn = -1; buf[0] = first; @@ -354,7 +353,7 @@ yyGetIdent(int first) buf[nInBuf++] = '\0'; found = 0; - for (i = 0; (!found) && (i < numKeywords); i++) { + for (int i = 0; (!found) && (i < numKeywords); i++) { if (uStrCaseCmp(buf, keywords[i].keyword) == 0) { rtrn = keywords[i].token; found = 1; @@ -260,12 +260,9 @@ GetDisplay(char *program, char *dpyName, int *opcodeRtrn, int *evBaseRtrn) void InterpretConfigs(CfgEntryPtr cfg) { - char *name; - unsigned priv = 0; - config = cfg; while (cfg != NULL) { - name = cfg->name.str; + char *name = cfg->name.str; if (cfg->entry_type == VariableDef) { if (uStrCaseEqual(name, "sounddirectory") || uStrCaseEqual(name, "sounddir")) { @@ -288,7 +285,9 @@ InterpretConfigs(CfgEntryPtr cfg) uAction("Ignored\n"); } } - else if (cfg->entry_type == EventDef) + else if (cfg->entry_type == EventDef) { + unsigned int priv; + switch (cfg->event_type) { case XkbBellNotify: if (name != NULL) @@ -324,6 +323,7 @@ InterpretConfigs(CfgEntryPtr cfg) /* nothing to do */ break; } + } eventMask |= (1L << cfg->event_type); cfg = cfg->next; } |