提交 f1bcbe14 编写于 作者: J Jiri Slaby 提交者: Greg Kroah-Hartman

vt: make tc write more obvious in vc_con_write_normal

Nested ternary operators spread over 4 lines are really evil for
reading. Turn the outer one to proper 'if'. Now, we see, there is a
common path, so the code can be simplified. This way, the code is
understandable now.

Checked using symbolic execution (klee), that the old and new behaviors
are the same.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200615074910.19267-22-jslaby@suse.czSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f3205b29
...@@ -2787,11 +2787,14 @@ static int vc_con_write_normal(struct vc_data *vc, int tc, int c, ...@@ -2787,11 +2787,14 @@ static int vc_con_write_normal(struct vc_data *vc, int tc, int c,
if (vc->vc_decim) if (vc->vc_decim)
insert_char(vc, 1); insert_char(vc, 1);
vc_uniscr_putc(vc, next_c); vc_uniscr_putc(vc, next_c);
scr_writew(himask ?
((vc_attr << 8) & ~himask) + if (himask)
((tc & 0x100) ? himask : 0) + (tc & 0xff) : tc = ((tc & 0x100) ? himask : 0) |
(vc_attr << 8) + tc, (tc & 0xff);
(u16 *)vc->vc_pos); tc |= (vc_attr << 8) & ~himask;
scr_writew(tc, (u16 *)vc->vc_pos);
if (con_should_update(vc) && draw->x < 0) { if (con_should_update(vc) && draw->x < 0) {
draw->x = vc->state.x; draw->x = vc->state.x;
draw->from = vc->vc_pos; draw->from = vc->vc_pos;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册