From: Markus Armbruster <armbru@redhat.com>
To: "Volker Rümelin" <vr_qemu@t-online.de>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [PATCH] ui: remove useless typecasts
Date: Mon, 24 Oct 2022 07:44:57 +0200 [thread overview]
Message-ID: <87k04pu65i.fsf@pond.sub.org> (raw)
In-Reply-To: <20221022141204.29358-1-vr_qemu@t-online.de> ("Volker Rümelin"'s message of "Sat, 22 Oct 2022 16:12:04 +0200")
Volker Rümelin <vr_qemu@t-online.de> writes:
> Commit 8f9abdf586 ("chardev: src buffer const for write functions")
> changed the type of the second parameter of qemu_chr_be_write()
> from uint8_t * to const uint8_t *. Remove the now useless type
> casts from qemu_chr_be_write() function calls in ui/console.c and
> ui/gtk.c.
>
> Cc: qemu-trivial@nongnu.org
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
> ui/console.c | 2 +-
> ui/gtk.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ui/console.c b/ui/console.c
> index 49da6a91df..65c117874c 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1297,7 +1297,7 @@ static void kbd_send_chars(QemuConsole *s)
> uint32_t size;
>
> buf = fifo8_pop_buf(&s->out_fifo, MIN(len, avail), &size);
> - qemu_chr_be_write(s->chr, (uint8_t *)buf, size);
> + qemu_chr_be_write(s->chr, buf, size);
> len = qemu_chr_be_can_write(s->chr);
> avail -= size;
> }
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 92daaa6a6e..7ec21f7798 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1763,7 +1763,7 @@ static void gd_vc_send_chars(VirtualConsole *vc)
> uint32_t size;
>
> buf = fifo8_pop_buf(&vc->vte.out_fifo, MIN(len, avail), &size);
> - qemu_chr_be_write(vc->vte.chr, (uint8_t *)buf, size);
> + qemu_chr_be_write(vc->vte.chr, buf, size);
> len = qemu_chr_be_can_write(vc->vte.chr);
> avail -= size;
> }
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Related:
tests/unit/test-char.c:219: qemu_chr_be_write(base, (void *)"hello", 6);
tests/unit/test-char.c:236: qemu_chr_be_write(base, (void *)"\1b", 2);
tests/unit/test-char.c:240: qemu_chr_be_write(base, (void *)"\1c", 2);
tests/unit/test-char.c:247: qemu_chr_be_write(base, (void *)"hello", 6);
tests/unit/test-char.c:253: qemu_chr_be_write(base, (void *)"\1b", 2);
tests/unit/test-char.c:319: qemu_chr_be_write(base, (void *)"hello", 6);
tests/unit/test-char.c:323: qemu_chr_be_write(base, (void *)"\1c", 2);
tests/unit/test-char.c:324: qemu_chr_be_write(base, (void *)"hello", 6);
tests/unit/test-char.c:331: qemu_chr_be_write(base, (void *)"\1?", 2);
The cast strips away const, and the conversion adds it back. Slightly
unclean. Not sure its worth a patch.
I wonder why the parameter isn't const void *, though.
next prev parent reply other threads:[~2022-10-24 5:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
2022-10-24 5:44 ` Markus Armbruster [this message]
2022-10-24 6:48 ` Philippe Mathieu-Daudé
2022-10-24 10:12 ` Claudio Fontana
2022-10-24 11:43 ` Laurent Vivier
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=87k04pu65i.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=vr_qemu@t-online.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.