* [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow
@ 2023-10-04 8:39 Thomas Huth
2023-10-04 8:55 ` Philippe Mathieu-Daudé
2023-10-04 10:43 ` Markus Armbruster
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2023-10-04 8:39 UTC (permalink / raw)
To: qemu-devel, Gerd Hoffmann; +Cc: Markus Armbruster, qemu-trivial
The "err" variable is only used twice in this code, in a very
local fashion of first assigning it and then checking it in the
next line. So there is no need to declare this variable a second
time in the innermost block, we can re-use the variable that is
declared at the beginning of the function. This fixes the compiler
warning that occurs with "-Wshadow".
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
audio/ossaudio.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 3f31852371..c5858284a1 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -549,7 +549,6 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as,
hw->size_emul);
hw->buf_emul = NULL;
} else {
- int err;
int trig = 0;
if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n");
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow
2023-10-04 8:39 [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow Thomas Huth
@ 2023-10-04 8:55 ` Philippe Mathieu-Daudé
2023-10-04 10:43 ` Markus Armbruster
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-04 8:55 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Gerd Hoffmann; +Cc: Markus Armbruster, qemu-trivial
On 4/10/23 10:39, Thomas Huth wrote:
> The "err" variable is only used twice in this code, in a very
> local fashion of first assigning it and then checking it in the
> next line. So there is no need to declare this variable a second
> time in the innermost block, we can re-use the variable that is
> declared at the beginning of the function. This fixes the compiler
> warning that occurs with "-Wshadow".
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> audio/ossaudio.c | 1 -
> 1 file changed, 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow
2023-10-04 8:39 [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow Thomas Huth
2023-10-04 8:55 ` Philippe Mathieu-Daudé
@ 2023-10-04 10:43 ` Markus Armbruster
1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2023-10-04 10:43 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, Gerd Hoffmann, qemu-trivial
Thomas Huth <thuth@redhat.com> writes:
> The "err" variable is only used twice in this code, in a very
> local fashion of first assigning it and then checking it in the
> next line. So there is no need to declare this variable a second
> time in the innermost block, we can re-use the variable that is
> declared at the beginning of the function. This fixes the compiler
> warning that occurs with "-Wshadow".
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Queued. Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-04 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 8:39 [PATCH] audio/ossaudio: Fix compiler warning with -Wshadow Thomas Huth
2023-10-04 8:55 ` Philippe Mathieu-Daudé
2023-10-04 10:43 ` Markus Armbruster
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).