chardev/mux: use bool type for linestart
and term_got_escape
Those are boolean variables, not signed integers. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-4-r.peniaev@gmail.com>
This commit is contained in:
parent
58e5a3ae42
commit
1ba399406a
@ -73,11 +73,11 @@ static int mux_chr_write(Chardev *chr, const uint8_t *buf, int len)
|
|||||||
* qemu_chr_fe_write and background I/O callbacks */
|
* qemu_chr_fe_write and background I/O callbacks */
|
||||||
qemu_chr_fe_write_all(&d->chr,
|
qemu_chr_fe_write_all(&d->chr,
|
||||||
(uint8_t *)buf1, strlen(buf1));
|
(uint8_t *)buf1, strlen(buf1));
|
||||||
d->linestart = 0;
|
d->linestart = false;
|
||||||
}
|
}
|
||||||
ret += qemu_chr_fe_write(&d->chr, buf + i, 1);
|
ret += qemu_chr_fe_write(&d->chr, buf + i, 1);
|
||||||
if (buf[i] == '\n') {
|
if (buf[i] == '\n') {
|
||||||
d->linestart = 1;
|
d->linestart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ static void mux_chr_be_event(Chardev *chr, QEMUChrEvent event)
|
|||||||
static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
|
static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
|
||||||
{
|
{
|
||||||
if (d->term_got_escape) {
|
if (d->term_got_escape) {
|
||||||
d->term_got_escape = 0;
|
d->term_got_escape = false;
|
||||||
if (ch == term_escape_char) {
|
if (ch == term_escape_char) {
|
||||||
goto send_char;
|
goto send_char;
|
||||||
}
|
}
|
||||||
@ -175,11 +175,11 @@ static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
|
|||||||
case 't':
|
case 't':
|
||||||
d->timestamps = !d->timestamps;
|
d->timestamps = !d->timestamps;
|
||||||
d->timestamps_start = -1;
|
d->timestamps_start = -1;
|
||||||
d->linestart = 0;
|
d->linestart = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (ch == term_escape_char) {
|
} else if (ch == term_escape_char) {
|
||||||
d->term_got_escape = 1;
|
d->term_got_escape = true;
|
||||||
} else {
|
} else {
|
||||||
send_char:
|
send_char:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -39,7 +39,7 @@ struct MuxChardev {
|
|||||||
CharBackend chr;
|
CharBackend chr;
|
||||||
int focus;
|
int focus;
|
||||||
int mux_cnt;
|
int mux_cnt;
|
||||||
int term_got_escape;
|
bool term_got_escape;
|
||||||
/* Intermediate input buffer catches escape sequences even if the
|
/* Intermediate input buffer catches escape sequences even if the
|
||||||
currently active device is not accepting any input - but only until it
|
currently active device is not accepting any input - but only until it
|
||||||
is full as well. */
|
is full as well. */
|
||||||
@ -49,7 +49,7 @@ struct MuxChardev {
|
|||||||
int timestamps;
|
int timestamps;
|
||||||
|
|
||||||
/* Protected by the Chardev chr_write_lock. */
|
/* Protected by the Chardev chr_write_lock. */
|
||||||
int linestart;
|
bool linestart;
|
||||||
int64_t timestamps_start;
|
int64_t timestamps_start;
|
||||||
};
|
};
|
||||||
typedef struct MuxChardev MuxChardev;
|
typedef struct MuxChardev MuxChardev;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user