summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2013-02-25 00:19:51 +0200
committerDaniel Stone <daniel@fooishbar.org>2013-03-18 22:20:02 +0000
commita46e4cc163f1d867e0105758feb6e52b4ebb7c7b (patch)
tree412891e2dab1510430ddba2b5f77c9555d3ea0ae /src
parentc7aef1664922b47cdc8ea06513d0e1898889bfe3 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/xkbcomp/compat.c3
-rw-r--r--src/xkbcomp/keycodes.c3
-rw-r--r--src/xkbcomp/symbols.c26
-rw-r--r--src/xkbcomp/types.c7
4 files changed, 17 insertions, 22 deletions
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: