summaryrefslogtreecommitdiff
path: root/xkbpath.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 11:38:04 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 14:35:34 -0800
commit64761ee9424f755b84ab0ce02d13eda32d215a14 (patch)
tree0d5369ba1460fb9c4be686511de659ed653362ba /xkbpath.c
parent9737af15196380a1687d18a17d297ee17b45a83f (diff)
downloadxorg-app-xkbcomp-64761ee9424f755b84ab0ce02d13eda32d215a14.tar.gz
Variable scope reductions
Some found by cppcheck, some found by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xkbpath.c')
-rw-r--r--xkbpath.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/xkbpath.c b/xkbpath.c
index 9f620e6..ee8a91e 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -178,11 +178,9 @@ XkbAddDefaultDirectoriesToPath(void)
void
XkbClearIncludePath(void)
{
- int i;
-
if (szPath > 0)
{
- for (i = 0; i < nPathEntries; i++)
+ for (int i = 0; i < nPathEntries; i++)
{
if (includePath[i] != NULL)
{
@@ -376,17 +374,16 @@ XkbFindFileInCache(char *name, unsigned type, char **pathRtrn)
FILE *
XkbFindFileInPath(char *name, unsigned type, char **pathRtrn)
{
- int i;
FILE *file = NULL;
- int nameLen, typeLen, pathLen;
+ int nameLen, typeLen;
char buf[PATH_MAX], *typeDir;
typeDir = XkbDirectoryForInclude(type);
nameLen = strlen(name);
typeLen = strlen(typeDir);
- for (i = 0; i < nPathEntries; i++)
+ for (int i = 0; i < nPathEntries; i++)
{
- pathLen = strlen(includePath[i]);
+ int pathLen = strlen(includePath[i]);
if (typeLen < 1)
continue;