Fix dead assignments "Value stored to 'stmt' is never read" "Value stored to 'grp_to_use' is never read" And change 'grp' to 'group' if we're here. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 4361abe..7a556ac 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -928,14 +928,13 @@ static void
HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge)
{
bool ok;
- ParseCommon *stmt;
merge = (merge == MERGE_DEFAULT ? MERGE_AUGMENT : merge);
free(info->name);
info->name = strdup_safe(file->name);
- for (stmt = file->defs; stmt; stmt = stmt->next) {
+ for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) {
switch (stmt->type) {
case STMT_INCLUDE:
ok = HandleIncludeCompatMap(info, (IncludeStmt *) stmt);
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index b46036e..2433872 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -590,13 +590,12 @@ HandleLedNameDef(KeyNamesInfo *info, LedNameDef *def,
static void
HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge)
{
- ParseCommon *stmt;
bool ok;
free(info->name);
info->name = strdup_safe(file->name);
- for (stmt = file->defs; stmt; stmt = stmt->next) {
+ for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) {
switch (stmt->type) {
case STMT_INCLUDE:
ok = HandleIncludeKeycodes(info, (IncludeStmt *) stmt);
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 83185dc..b71fb09 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -988,7 +988,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
static int
SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
{
- xkb_layout_index_t grp, grp_to_use;
+ xkb_layout_index_t group, group_to_use;
xkb_atom_t name;
if (!arrayNdx) {
@@ -998,7 +998,7 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
return false;
}
- if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &grp)) {
+ if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &group)) {
log_err(info->keymap->ctx,
"Illegal index in group name definition; "
"Definition with non-integer array index ignored\n");
@@ -1008,30 +1008,30 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
if (!ExprResolveString(info->keymap->ctx, value, &name)) {
log_err(info->keymap->ctx,
"Group name must be a string; "
- "Illegal name for group %d ignored\n", grp);
+ "Illegal name for group %d ignored\n", group);
return false;
}
- grp_to_use = XKB_LAYOUT_INVALID;
if (info->explicit_group == XKB_LAYOUT_INVALID) {
- grp_to_use = grp - 1;
+ group_to_use = group - 1;
}
- else if (grp - 1 == 0) {
- grp_to_use = info->explicit_group;
+ else if (group - 1 == 0) {
+ group_to_use = info->explicit_group;
}
else {
log_warn(info->keymap->ctx,
"An explicit group was specified for the '%s' map, "
"but it provides a name for a group other than Group1 (%d); "
"Ignoring group name '%s'\n",
- info->name, grp,
+ info->name, group,
xkb_atom_text(info->keymap->ctx, name));
return false;
}
- if (grp_to_use >= darray_size(info->group_names))
- darray_resize0(info->group_names, grp_to_use + 1);
- darray_item(info->group_names, grp_to_use) = name;
+ if (group_to_use >= darray_size(info->group_names))
+ darray_resize0(info->group_names, group_to_use + 1);
+ darray_item(info->group_names, group_to_use) = name;
+
return true;
}
@@ -1236,13 +1236,11 @@ static void
HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge)
{
bool ok;
- ParseCommon *stmt;
free(info->name);
info->name = strdup_safe(file->name);
- stmt = file->defs;
- for (stmt = file->defs; stmt; stmt = stmt->next) {
+ for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) {
switch (stmt->type) {
case STMT_INCLUDE:
ok = HandleIncludeSymbols(info, (IncludeStmt *) stmt);
diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c
index b1666fa..227d390 100644
--- a/src/xkbcomp/types.c
+++ b/src/xkbcomp/types.c
@@ -738,17 +738,16 @@ static void
HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
{
bool ok;
- ParseCommon *stmt;
free(info->name);
info->name = strdup_safe(file->name);
- for (stmt = file->defs; stmt; stmt = stmt->next) {
+ for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) {
switch (stmt->type) {
case STMT_INCLUDE:
ok = HandleIncludeKeyTypes(info, (IncludeStmt *) stmt);
break;
- case STMT_TYPE: /* e.g. type "ONE_LEVEL" */
+ case STMT_TYPE:
ok = HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge);
break;
case STMT_VAR:
@@ -757,7 +756,7 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
"Statement ignored\n");
ok = true;
break;
- case STMT_VMOD: /* virtual_modifiers NumLock, ... */
+ case STMT_VMOD:
ok = HandleVModDef(info->keymap, (VModDef *) stmt);
break;
default: