* [PATCH] audio: remove shadowed locals
@ 2023-09-26 15:49 Paolo Bonzini
2023-09-26 15:57 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2023-09-26 15:49 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/audio.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index 90c7c49d116..2f479657117 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1706,7 +1706,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
size_t i;
int done = 0;
const char *drvname = NULL;
- VMChangeStateEntry *e;
+ VMChangeStateEntry *vmse;
AudioState *s;
struct audio_driver *driver;
/* silence gcc warning about uninitialized variable */
@@ -1824,8 +1824,8 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
}
- e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
- if (!e) {
+ vmse = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
+ if (!vmse) {
dolog ("warning: Could not register change state handler\n"
"(Audio can continue looping even after stopping the VM)\n");
}
@@ -1900,10 +1900,8 @@ CaptureVoiceOut *AUD_add_capture(
cap = audio_pcm_capture_find_specific(s, as);
if (cap) {
QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
- return cap;
} else {
HWVoiceOut *hw;
- CaptureVoiceOut *cap;
cap = g_malloc0(sizeof(*cap));
@@ -1937,8 +1935,9 @@ CaptureVoiceOut *AUD_add_capture(
QLIST_FOREACH(hw, &s->hw_head_out, entries) {
audio_attach_capture (hw);
}
- return cap;
}
+
+ return cap;
}
void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] audio: remove shadowed locals
2023-09-26 15:49 [PATCH] audio: remove shadowed locals Paolo Bonzini
@ 2023-09-26 15:57 ` Marc-André Lureau
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2023-09-26 15:57 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, armbru
On Tue, Sep 26, 2023 at 7:50 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/audio.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/audio/audio.c b/audio/audio.c
> index 90c7c49d116..2f479657117 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -1706,7 +1706,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
> size_t i;
> int done = 0;
> const char *drvname = NULL;
> - VMChangeStateEntry *e;
> + VMChangeStateEntry *vmse;
> AudioState *s;
> struct audio_driver *driver;
> /* silence gcc warning about uninitialized variable */
> @@ -1824,8 +1824,8 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
> s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
> }
>
> - e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
> - if (!e) {
> + vmse = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
> + if (!vmse) {
> dolog ("warning: Could not register change state handler\n"
> "(Audio can continue looping even after stopping the VM)\n");
> }
> @@ -1900,10 +1900,8 @@ CaptureVoiceOut *AUD_add_capture(
> cap = audio_pcm_capture_find_specific(s, as);
> if (cap) {
> QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
> - return cap;
> } else {
> HWVoiceOut *hw;
> - CaptureVoiceOut *cap;
>
> cap = g_malloc0(sizeof(*cap));
>
> @@ -1937,8 +1935,9 @@ CaptureVoiceOut *AUD_add_capture(
> QLIST_FOREACH(hw, &s->hw_head_out, entries) {
> audio_attach_capture (hw);
> }
> - return cap;
> }
> +
> + return cap;
> }
>
> void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
> --
> 2.41.0
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-26 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26 15:49 [PATCH] audio: remove shadowed locals Paolo Bonzini
2023-09-26 15:57 ` Marc-André Lureau
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).