From: Roman Penyaev <r.peniaev@gmail.com>
Cc: "Roman Penyaev" <r.peniaev@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org
Subject: [PATCH v2 3/8] chardev/mux: use bool type for `linestart` and `term_got_escape`
Date: Mon, 14 Oct 2024 17:24:03 +0200 [thread overview]
Message-ID: <20241014152408.427700-4-r.peniaev@gmail.com> (raw)
In-Reply-To: <20241014152408.427700-1-r.peniaev@gmail.com>
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
---
chardev/char-mux.c | 10 +++++-----
chardev/chardev-internal.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index ee2d47b20d9b..728596c6f346 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -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_all(&d->chr,
(uint8_t *)buf1, strlen(buf1));
- d->linestart = 0;
+ d->linestart = false;
}
ret += qemu_chr_fe_write(&d->chr, buf + i, 1);
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)
{
if (d->term_got_escape) {
- d->term_got_escape = 0;
+ d->term_got_escape = false;
if (ch == term_escape_char) {
goto send_char;
}
@@ -175,11 +175,11 @@ static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
case 't':
d->timestamps = !d->timestamps;
d->timestamps_start = -1;
- d->linestart = 0;
+ d->linestart = false;
break;
}
} else if (ch == term_escape_char) {
- d->term_got_escape = 1;
+ d->term_got_escape = true;
} else {
send_char:
return 1;
diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h
index c3024b51fdda..975c16de803e 100644
--- a/chardev/chardev-internal.h
+++ b/chardev/chardev-internal.h
@@ -39,7 +39,7 @@ struct MuxChardev {
CharBackend chr;
int focus;
int mux_cnt;
- int term_got_escape;
+ bool term_got_escape;
/* Intermediate input buffer catches escape sequences even if the
currently active device is not accepting any input - but only until it
is full as well. */
@@ -49,7 +49,7 @@ struct MuxChardev {
int timestamps;
/* Protected by the Chardev chr_write_lock. */
- int linestart;
+ bool linestart;
int64_t timestamps_start;
};
typedef struct MuxChardev MuxChardev;
--
2.34.1
next prev parent reply other threads:[~2024-10-14 15:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 15:24 [PATCH v2 0/8] chardev/mux: implement frontend detach Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 1/8] chardev/char: fix qemu_chr_is_busy() check Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 2/8] chardev/chardev-internal: remove unused `max_size` struct member Roman Penyaev
2024-10-22 5:21 ` CLEMENT MATHIEU--DRIF
2024-10-14 15:24 ` Roman Penyaev [this message]
2024-10-22 5:21 ` [PATCH v2 3/8] chardev/mux: use bool type for `linestart` and `term_got_escape` CLEMENT MATHIEU--DRIF
2024-10-14 15:24 ` [PATCH v2 4/8] chardev/mux: convert size members to unsigned int Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 5/8] chardev/mux: introduce `mux_chr_attach_frontend() call Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 6/8] chardev/mux: switch mux frontends management to bitset Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 7/8] chardev/mux: implement detach of frontends from mux Roman Penyaev
2024-10-22 5:20 ` CLEMENT MATHIEU--DRIF
2024-11-02 11:19 ` Roman Penyaev
2024-10-14 15:24 ` [PATCH v2 8/8] tests/unit/test-char: implement a few mux remove test cases Roman Penyaev
2024-10-15 8:50 ` Marc-André Lureau
2024-10-15 16:51 ` Roman Penyaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241014152408.427700-4-r.peniaev@gmail.com \
--to=r.peniaev@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).