mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 18:36:30 +01:00
bat: Don't pass incompatible function pointers to pthread_cleanup_push()
pthread_cleanup_push() takes a function pointer for void (void *). Although it may work in most cases, we shouldn't pass an incompatible function pointer there, as some old gcc complains: alsa.c:560: warning: initialization from incompatible pointer type alsa.c:562: warning: initialization from incompatible pointer type Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3bf8e79c3b
commit
ed0cce1b60
1 changed files with 12 additions and 2 deletions
14
bat/alsa.c
14
bat/alsa.c
|
@ -505,6 +505,16 @@ static int read_from_pcm_loop(FILE *fp, int count,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void pcm_cleanup(void *p)
|
||||
{
|
||||
snd_pcm_close(p);
|
||||
}
|
||||
|
||||
static void file_cleanup(void *p)
|
||||
{
|
||||
fclose(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Record
|
||||
*/
|
||||
|
@ -557,9 +567,9 @@ void *record_alsa(struct bat *bat)
|
|||
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||
pthread_cleanup_push(snd_pcm_close, sndpcm.handle);
|
||||
pthread_cleanup_push(pcm_cleanup, sndpcm.handle);
|
||||
pthread_cleanup_push(free, sndpcm.buffer);
|
||||
pthread_cleanup_push(fclose, fp);
|
||||
pthread_cleanup_push(file_cleanup, fp);
|
||||
|
||||
err = write_wav_header(fp, &wav, bat);
|
||||
if (err != 0) {
|
||||
|
|
Loading…
Reference in a new issue