diff options
Diffstat (limited to 'keycodes.c')
-rw-r--r-- | keycodes.c | 26 |
1 files changed, 8 insertions, 18 deletions
@@ -130,9 +130,7 @@ NextIndicatorName(KeyNamesInfo * info) static IndicatorNameInfo * FindIndicatorByIndex(KeyNamesInfo * info, int ndx) { - IndicatorNameInfo *old; - - for (old = info->leds; old != NULL; + for (IndicatorNameInfo *old = info->leds; old != NULL; old = (IndicatorNameInfo *) old->defs.next) { if (old->ndx == ndx) @@ -144,9 +142,7 @@ FindIndicatorByIndex(KeyNamesInfo * info, int ndx) static IndicatorNameInfo * FindIndicatorByName(KeyNamesInfo * info, Atom name) { - IndicatorNameInfo *old; - - for (old = info->leds; old != NULL; + for (IndicatorNameInfo *old = info->leds; old != NULL; old = (IndicatorNameInfo *) old->defs.next) { if (old->name == name) @@ -200,9 +196,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new) info->leds = (IndicatorNameInfo *) old->defs.next; else { - IndicatorNameInfo *tmp; - tmp = info->leds; - for (; tmp != NULL; + for (IndicatorNameInfo *tmp = info->leds; tmp != NULL; tmp = (IndicatorNameInfo *) tmp->defs.next) { if (tmp->defs.next == (CommonInfo *) old) @@ -307,9 +301,7 @@ InitKeyNamesInfo(KeyNamesInfo * info) static int FindKeyByLong(KeyNamesInfo * info, unsigned long name) { - int i; - - for (i = info->effectiveMin; i <= info->effectiveMax; i++) + for (int i = info->effectiveMin; i <= info->effectiveMax; i++) { if (info->names[i] == name) return i; @@ -435,9 +427,6 @@ static void MergeIncludedKeycodes(KeyNamesInfo * into, KeyNamesInfo * from, unsigned merge) { - int i; - char buf[5]; - if (from->errorCount > 0) { into->errorCount += from->errorCount; @@ -448,9 +437,11 @@ MergeIncludedKeycodes(KeyNamesInfo * into, KeyNamesInfo * from, into->name = from->name; from->name = NULL; } - for (i = from->computedMin; i <= from->computedMax; i++) + for (int i = from->computedMin; i <= from->computedMax; i++) { unsigned thisMerge; + char buf[5]; + if (from->names[i] == 0) continue; LongToKeyName(from->names[i], buf); @@ -540,11 +531,10 @@ HandleIncludeKeycodes(IncludeStmt * stmt, XkbDescPtr xkb, KeyNamesInfo * info) /* Do we have more than one include statement? */ if ((stmt->next != NULL) && (included.errorCount < 1)) { - IncludeStmt *next; unsigned op; KeyNamesInfo next_incl; - for (next = stmt->next; next != NULL; next = next->next) + for (IncludeStmt *next = stmt->next; next != NULL; next = next->next) { if ((next->file == NULL) && (next->map == NULL)) { |