tty: vt: use switch+case in the ESgetpars case

To be uniform in the 'c' handling, use switch-case (with ranges) even in
the ESgetpars case in do_con_trol().

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20240202065608.14019-21-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby (SUSE) 2024-02-02 07:56:06 +01:00 committed by Greg Kroah-Hartman
parent 3d5f5b9711
commit 137eb9ad22

View File

@ -2628,10 +2628,14 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, u8 c)
vc->vc_priv = EPecma;
fallthrough;
case ESgetpars: /* ESC [ aka CSI, parameters expected */
if (c == ';' && vc->vc_npar < NPAR - 1) {
vc->vc_npar++;
return;
} else if (c>='0' && c<='9') {
switch (c) {
case ';':
if (vc->vc_npar < NPAR - 1) {
vc->vc_npar++;
return;
}
break;
case '0' ... '9':
vc->vc_par[vc->vc_npar] *= 10;
vc->vc_par[vc->vc_npar] += c - '0';
return;