* [PATCH] ui: remove useless typecasts
@ 2022-10-22 14:12 Volker Rümelin
2022-10-24 5:44 ` Markus Armbruster
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Volker Rümelin @ 2022-10-22 14:12 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Marc-André Lureau, qemu-devel, qemu-trivial
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;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ui: remove useless typecasts
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
@ 2022-10-24 5:44 ` Markus Armbruster
2022-10-24 6:48 ` Philippe Mathieu-Daudé
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2022-10-24 5:44 UTC (permalink / raw)
To: Volker Rümelin
Cc: Gerd Hoffmann, Marc-André Lureau, qemu-devel, qemu-trivial
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ui: remove useless typecasts
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
2022-10-24 5:44 ` Markus Armbruster
@ 2022-10-24 6:48 ` Philippe Mathieu-Daudé
2022-10-24 10:12 ` Claudio Fontana
2022-10-24 11:43 ` Laurent Vivier
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-24 6:48 UTC (permalink / raw)
To: Volker Rümelin, Gerd Hoffmann
Cc: Marc-André Lureau, qemu-devel, qemu-trivial
On 22/10/22 16:12, Volker Rümelin wrote:
> 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(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ui: remove useless typecasts
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
2022-10-24 5:44 ` Markus Armbruster
2022-10-24 6:48 ` Philippe Mathieu-Daudé
@ 2022-10-24 10:12 ` Claudio Fontana
2022-10-24 11:43 ` Laurent Vivier
3 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2022-10-24 10:12 UTC (permalink / raw)
To: Volker Rümelin, Gerd Hoffmann
Cc: Marc-André Lureau, qemu-devel, qemu-trivial
On 10/22/22 16:12, Volker Rümelin wrote:
> 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>
Reviewed-by: Claudio Fontana <cfontana@suse.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;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ui: remove useless typecasts
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
` (2 preceding siblings ...)
2022-10-24 10:12 ` Claudio Fontana
@ 2022-10-24 11:43 ` Laurent Vivier
3 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2022-10-24 11:43 UTC (permalink / raw)
To: Volker Rümelin, Gerd Hoffmann
Cc: Marc-André Lureau, qemu-devel, qemu-trivial
Le 22/10/2022 à 16:12, Volker Rümelin a écrit :
> 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;
> }
Applied to my trivial-patches branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-24 11:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-22 14:12 [PATCH] ui: remove useless typecasts Volker Rümelin
2022-10-24 5:44 ` Markus Armbruster
2022-10-24 6:48 ` Philippe Mathieu-Daudé
2022-10-24 10:12 ` Claudio Fontana
2022-10-24 11:43 ` Laurent Vivier
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).