diff --git a/src/compose/paths.c b/src/compose/paths.c index 8deb1dd..158b4f4 100644 --- a/src/compose/paths.c +++ b/src/compose/paths.c @@ -166,8 +166,6 @@ get_home_xcompose_file_path(void) char * get_locale_compose_file_path(const char *locale) { - int ret; - const char *xlocaledir; char *resolved; char *path; @@ -193,8 +191,8 @@ get_locale_compose_file_path(const char *locale) path = resolved; } else { - xlocaledir = get_xlocaledir_path(); - ret = asprintf(&path, "%s/%s", xlocaledir, resolved); + const char *xlocaledir = get_xlocaledir_path(); + int ret = asprintf(&path, "%s/%s", xlocaledir, resolved); free(resolved); if (ret < 0) return NULL; diff --git a/src/state.c b/src/state.c index 642ed08..f7a429e 100644 --- a/src/state.c +++ b/src/state.c @@ -1163,14 +1163,13 @@ xkb_state_mod_indices_are_active(struct xkb_state *state, ...) { va_list ap; - xkb_mod_index_t idx = 0; xkb_mod_mask_t wanted = 0; int ret = 0; xkb_mod_index_t num_mods = xkb_keymap_num_mods(state->keymap); va_start(ap, match); while (1) { - idx = va_arg(ap, xkb_mod_index_t); + xkb_mod_index_t idx = va_arg(ap, xkb_mod_index_t); if (idx == XKB_MOD_INVALID) break; if (idx >= num_mods) { @@ -1214,12 +1213,12 @@ xkb_state_mod_names_are_active(struct xkb_state *state, ...) { va_list ap; - xkb_mod_index_t idx = 0; xkb_mod_mask_t wanted = 0; int ret = 0; va_start(ap, match); while (1) { + xkb_mod_index_t idx; const char *str = va_arg(ap, const char *); if (str == NULL) break; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index c0cda17..9ae26cd 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -377,8 +377,6 @@ static void MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, enum merge_mode merge) { - SymInterpInfo *si; - if (from->errorCount > 0) { into->errorCount += from->errorCount; return; @@ -396,6 +394,7 @@ MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, darray_init(from->interps); } else { + SymInterpInfo *si; darray_foreach(si, from->interps) { si->merge = (merge == MERGE_DEFAULT ? si->merge : merge); if (!AddInterp(into, si, false)) diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 409e1bf..cda93b0 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -499,8 +499,6 @@ static void MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, enum merge_mode merge) { - KeyInfo *keyi; - ModMapEntry *mm; xkb_atom_t *group_name; xkb_layout_index_t group_names_in_both; @@ -536,6 +534,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_init(from->keys); } else { + KeyInfo *keyi; darray_foreach(keyi, from->keys) { keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); if (!AddKeySymbols(into, keyi, false)) @@ -548,6 +547,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_init(from->modmaps); } else { + ModMapEntry *mm; darray_foreach(mm, from->modmaps) { mm->merge = (merge == MERGE_DEFAULT ? mm->merge : merge); if (!AddModMapEntry(into, mm)) @@ -1258,13 +1258,12 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) { struct xkb_key *key; xkb_layout_index_t group; - xkb_level_index_t level; bool got_one_group, got_one_level; group = 0; do { + xkb_level_index_t level = 0; got_one_group = false; - level = 0; do { got_one_level = false; xkb_keys_foreach(key, keymap) { @@ -1299,8 +1298,8 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) static xkb_atom_t FindAutomaticType(struct xkb_context *ctx, GroupInfo *groupi) { - xkb_keysym_t sym0, sym1, sym2, sym3; - xkb_level_index_t width = darray_size(groupi->levels); + xkb_keysym_t sym0, sym1; + const xkb_level_index_t width = darray_size(groupi->levels); #define GET_SYM(level) \ (darray_item(groupi->levels, level).num_syms == 0 ? \ @@ -1328,6 +1327,7 @@ FindAutomaticType(struct xkb_context *ctx, GroupInfo *groupi) if (width <= 4) { if (xkb_keysym_is_lower(sym0) && xkb_keysym_is_upper(sym1)) { + xkb_keysym_t sym2, sym3; sym2 = GET_SYM(2); sym3 = (width == 4 ? GET_SYM(3) : XKB_KEY_NoSymbol); diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c index 6c6a31f..8d87ad5 100644 --- a/src/xkbcomp/types.c +++ b/src/xkbcomp/types.c @@ -174,8 +174,6 @@ static void MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from, enum merge_mode merge) { - KeyTypeInfo *type; - if (from->errorCount > 0) { into->errorCount += from->errorCount; return; @@ -193,6 +191,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from, darray_init(from->types); } else { + KeyTypeInfo *type; darray_foreach(type, from->types) { type->merge = (merge == MERGE_DEFAULT ? type->merge : merge); if (!AddKeyType(into, type, false))