summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-22 11:11:00 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-22 11:35:53 -0700
commit199b00b2bbaf2dd90d95e9e3a77c738269ed3804 (patch)
treeb6f9803b332c79c61ef315fe5088e036cfb33b50
parentfa4be31580f5ea62556ac02dc2e07737a758de87 (diff)
Variable scope reduction as suggested by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--cfgscan.c5
-rw-r--r--xkbevd.c10
2 files changed, 7 insertions, 8 deletions
diff --git a/cfgscan.c b/cfgscan.c
index 3515b89..3a40f2c 100644
--- a/cfgscan.c
+++ b/cfgscan.c
@@ -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;
diff --git a/xkbevd.c b/xkbevd.c
index 8234dc6..516358b 100644
--- a/xkbevd.c
+++ b/xkbevd.c
@@ -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;
}