summaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2020-06-15 09:48:47 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-24 17:08:32 +0200
commit0d1ffef5782628aede95d5390c658c2027c53c55 (patch)
tree23eab77ac819b2f50a162a219d8e0b922f4d3990 /drivers/tty/vt
parentvt: extract attribute inversion to vc_invert_attr (diff)
downloadlinux-0d1ffef5782628aede95d5390c658c2027c53c55.tar.xz
linux-0d1ffef5782628aede95d5390c658c2027c53c55.zip
vt: move rescan_last_byte label earlier
This removes duplicated initialization of variables (after reordering 'c' initialization). It will also allow for eliminating whole translation into a separate function in the next patch. Note that vc_state, vc_utf etc. are checked with every rescan now. But they are immutable for non-control characters where rescan might be only necessary. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200615074910.19267-15-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index bf171bb1d2fd..93ad7e004900 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2717,10 +2717,11 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
while (!tty->stopped && count) {
int orig = *buf;
- c = orig;
buf++;
n++;
count--;
+rescan_last_byte:
+ c = orig;
rescan = false;
inverse = false;
width = 1;
@@ -2729,7 +2730,6 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
if (vc->vc_state != ESnormal) {
tc = c;
} else if (vc->vc_utf && !vc->vc_disp_ctrl) {
-rescan_last_byte:
tc = c = vc_translate_unicode(vc, c, &rescan);
if (tc == -1)
continue;
@@ -2834,13 +2834,9 @@ rescan_last_byte:
if (inverse)
con_flush(vc, draw_from, draw_to, &draw_x);
- if (rescan) {
- rescan = false;
- inverse = false;
- width = 1;
- c = orig;
+ if (rescan)
goto rescan_last_byte;
- }
+
continue;
}
con_flush(vc, draw_from, draw_to, &draw_x);