Download raw body.
tog: remove redundant variable
The variable 'child_focussed' in struct tog_view is redundant because all
reads of 'view->child_focussed' are preceded by a NULL check of 'child'.
So we might as well look at 'child->focussed' directly. And if this value
doesn't match 'child_focussed' then we have a bug.
ok?
diff a0250fd806b1fd439133c6c603585c452701c690 c65c245c8204d305868d74d1996bdbf196d4057b
blob - 7fbce6f00ea8ba6441c983e6bcd049840196dce6
blob + 19f8a058e47ae867d2b187b9c3a0d687d1b2d0c2
--- tog/tog.c
+++ tog/tog.c
@@ -449,7 +449,6 @@ struct tog_view {
int focussed;
struct tog_view *parent;
struct tog_view *child;
- int child_focussed;
/* type-specific state */
enum tog_view_type type;
@@ -849,10 +848,8 @@ view_input(struct tog_view **new, struct tog_view **de
case '\t':
if (view->child) {
*focus = view->child;
- view->child_focussed = 1;
} else if (view->parent) {
*focus = view->parent;
- view->parent->child_focussed = 0;
}
break;
case 'q':
@@ -868,7 +865,6 @@ view_input(struct tog_view **new, struct tog_view **de
break;
if (view_is_splitscreen(view->child)) {
*focus = view->child;
- view->child_focussed = 1;
err = view_fullscreen(view->child);
} else
err = view_splitscreen(view->child);
@@ -879,7 +875,6 @@ view_input(struct tog_view **new, struct tog_view **de
} else {
if (view_is_splitscreen(view)) {
*focus = view;
- view->parent->child_focussed = 1;
err = view_fullscreen(view);
} else {
err = view_splitscreen(view);
@@ -938,7 +933,7 @@ int
view_needs_focus_indication(struct tog_view *view)
{
if (view_is_parent_view(view)) {
- if (view->child == NULL || view->child_focussed)
+ if (view->child == NULL || view->child->focussed)
return 0;
if (!view_is_splitscreen(view->child))
return 0;
@@ -1009,7 +1004,8 @@ view_loop(struct tog_view *view)
else
view = NULL;
if (view) {
- if (view->child && view->child_focussed)
+ if (view->child &&
+ view->child->focussed)
focus_view = view->child;
else
focus_view = view;
@@ -2440,7 +2436,6 @@ input_log_view(struct tog_view **new_view, struct tog_
break;
}
*focus_view = diff_view;
- view->child_focussed = 1;
} else
*new_view = diff_view;
break;
@@ -2463,7 +2458,6 @@ input_log_view(struct tog_view **new_view, struct tog_
break;
}
*focus_view = tree_view;
- view->child_focussed = 1;
} else
*new_view = tree_view;
break;
@@ -2568,7 +2562,6 @@ input_log_view(struct tog_view **new_view, struct tog_
break;
}
*focus_view = ref_view;
- view->child_focussed = 1;
} else
*new_view = ref_view;
break;
@@ -4613,7 +4606,6 @@ input_blame_view(struct tog_view **new_view, struct to
break;
}
*focus_view = diff_view;
- view->child_focussed = 1;
} else
*new_view = diff_view;
if (err)
@@ -5320,7 +5312,6 @@ input_tree_view(struct tog_view **new_view, struct tog
break;
}
*focus_view = log_view;
- view->child_focussed = 1;
} else
*new_view = log_view;
break;
@@ -5346,7 +5337,6 @@ input_tree_view(struct tog_view **new_view, struct tog
break;
}
*focus_view = ref_view;
- view->child_focussed = 1;
} else
*new_view = ref_view;
break;
@@ -5445,7 +5435,6 @@ input_tree_view(struct tog_view **new_view, struct tog
break;
}
*focus_view = blame_view;
- view->child_focussed = 1;
} else
*new_view = blame_view;
}
@@ -6107,7 +6096,6 @@ input_ref_view(struct tog_view **new_view, struct tog_
break;
}
*focus_view = log_view;
- view->child_focussed = 1;
} else
*new_view = log_view;
break;
@@ -6130,7 +6118,6 @@ input_ref_view(struct tog_view **new_view, struct tog_
break;
}
*focus_view = tree_view;
- view->child_focussed = 1;
} else
*new_view = tree_view;
break;
tog: remove redundant variable