summaryrefslogtreecommitdiff
path: root/indicators.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 /indicators.c
parent9737af15196380a1687d18a17d297ee17b45a83f (diff)
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 'indicators.c')
-rw-r--r--indicators.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/indicators.c b/indicators.c
index 3ed0bee..4eaa6ae 100644
--- a/indicators.c
+++ b/indicators.c
@@ -60,13 +60,14 @@ LEDInfo *
AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new)
{
LEDInfo *old, *last;
- unsigned collide;
last = NULL;
for (old = oldLEDs; old != NULL; old = (LEDInfo *) old->defs.next)
{
if (old->name == new->name)
{
+ unsigned collide;
+
if ((old->real_mods == new->real_mods) &&
(old->vmods == new->vmods) &&
(old->groups == new->groups) &&
@@ -327,8 +328,7 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
XkbDescPtr xkb,
LEDInfo * dflt, LEDInfo * oldLEDs, unsigned merge)
{
- LEDInfo led, *rtrn;
- VarDef *var;
+ LEDInfo led;
Bool ok;
if (def->merge != MergeDefault)
@@ -339,7 +339,8 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
led.name = def->name;
ok = True;
- for (var = def->body; var != NULL; var = (VarDef *) var->common.next)
+ for (VarDef *var = def->body; var != NULL;
+ var = (VarDef *) var->common.next)
{
ExprResult elem, field;
ExprDef *arrayNdx;
@@ -364,7 +365,7 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
}
if (ok)
{
- rtrn = AddIndicatorMap(oldLEDs, &led);
+ LEDInfo *rtrn = AddIndicatorMap(oldLEDs, &led);
return rtrn;
}
return NULL;
@@ -445,7 +446,6 @@ BindIndicators(XkbFileInfo * result,
Bool force, LEDInfo * unbound, LEDInfo ** unboundRtrn)
{
XkbDescPtr xkb;
- int i;
LEDInfo *led, *next, *last;
xkb = result->xkb;
@@ -455,7 +455,7 @@ BindIndicators(XkbFileInfo * result,
{
if (led->indicator == _LED_NotBound)
{
- for (i = 0; i < XkbNumIndicators; i++)
+ for (int i = 0; i < XkbNumIndicators; i++)
{
if (xkb->names->indicators[i] == led->name)
{
@@ -471,7 +471,7 @@ BindIndicators(XkbFileInfo * result,
{
if (led->indicator == _LED_NotBound)
{
- for (i = 0; i < XkbNumIndicators; i++)
+ for (int i = 0; i < XkbNumIndicators; i++)
{
if (xkb->names->indicators[i] == None)
{