gcc: preserve CXXFLAGS_FOR_TARGET
[buildroot-gz.git] / package / alsa-utils / 0002-bat-Don-t-pass-incompatible-function-pointers-to-pth.patch
blob1aee9aeaccf1930edf11c4c21dcf163ae3f9749a
1 bat: Don't pass incompatible function pointers to pthread_cleanup_push()
3 Patch backported from upstream:
5 http://git.alsa-project.org/?p=alsa-utils.git;a=commit;h=ed0cce1b6061aade0077982cb5d22fa68ddffd2f
7 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
9 From ed0cce1b6061aade0077982cb5d22fa68ddffd2f Mon Sep 17 00:00:00 2001
10 From: Takashi Iwai <tiwai@suse.de>
11 Date: Mon, 9 Nov 2015 14:09:50 +0100
12 Subject: [PATCH 2/2] bat: Don't pass incompatible function pointers to
13 pthread_cleanup_push()
15 pthread_cleanup_push() takes a function pointer for void (void *).
16 Although it may work in most cases, we shouldn't pass an incompatible
17 function pointer there, as some old gcc complains:
18 alsa.c:560: warning: initialization from incompatible pointer type
19 alsa.c:562: warning: initialization from incompatible pointer type
21 Signed-off-by: Takashi Iwai <tiwai@suse.de>
22 ---
23 bat/alsa.c | 14 ++++++++++++--
24 1 file changed, 12 insertions(+), 2 deletions(-)
26 diff --git a/bat/alsa.c b/bat/alsa.c
27 index d31a633..5eaa25b 100644
28 --- a/bat/alsa.c
29 +++ b/bat/alsa.c
30 @@ -505,6 +505,16 @@ static int read_from_pcm_loop(FILE *fp, int count,
31 return 0;
34 +static void pcm_cleanup(void *p)
36 + snd_pcm_close(p);
39 +static void file_cleanup(void *p)
41 + fclose(p);
44 /**
45 * Record
47 @@ -557,9 +567,9 @@ void *record_alsa(struct bat *bat)
49 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
50 pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
51 - pthread_cleanup_push(snd_pcm_close, sndpcm.handle);
52 + pthread_cleanup_push(pcm_cleanup, sndpcm.handle);
53 pthread_cleanup_push(free, sndpcm.buffer);
54 - pthread_cleanup_push(fclose, fp);
55 + pthread_cleanup_push(file_cleanup, fp);
57 err = write_wav_header(fp, &wav, bat);
58 if (err != 0) {
59 --
60 2.4.10