vc: extract detecting control characters from do_con_write
authorJiri Slaby <jslaby@suse.cz>
Mon, 15 Jun 2020 07:48:50 +0000 (09:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:08:32 +0000 (17:08 +0200)
commit754bda9807f2fcc0fe32ebeaef9f6443b2151059
treeeecffd00a02ba5720d905a3e8d37151bf8bfef8c
parent917ae1a9907bf33fe41fdfe68c6fcb03dfa07ed2
vc: extract detecting control characters from do_con_write

Move the control characters detection to a separate function dubbed
vc_is_control. It makes the 14 subexpressions a "bit" more readable. And
also simplifies next patches.

It moves also CTRL_ACTION and CTRL_ALWAYS to this new function, as they
are used exclusively here. While at it, these are converted to static
const variables.

And we use "& BIT()" instead of ">>" and "& 1".

Checked using symbolic execution (klee), that the old and new
behaviors are the same.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200615074910.19267-18-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c