audio: Replace AUDIO_FUNC with __func__

Apparently we don't use __MSC_VER as a compiler anymore and we always
require a C99 compiler (which means we always have __func__) so we don't
need a special AUDIO_FUNC macro. We can just replace AUDIO_FUNC with
__func__ instead.

Checkpatch failures were manually fixed.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-2-armbru@redhat.com>
master
Alistair Francis 2018-02-03 09:43:02 +01:00 committed by Markus Armbruster
parent 508de4780c
commit 470bcabd8f
11 changed files with 85 additions and 93 deletions

View File

@ -823,7 +823,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = obt.samples; hw->samples = obt.samples;
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); alsa->pcm_buf = audio_calloc(__func__, obt.samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) { if (!alsa->pcm_buf) {
dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);
@ -934,7 +934,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = obt.samples; hw->samples = obt.samples;
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); alsa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) { if (!alsa->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);

View File

@ -424,12 +424,12 @@ static void audio_process_options (const char *prefix,
const char qemu_prefix[] = "QEMU_"; const char qemu_prefix[] = "QEMU_";
size_t preflen, optlen; size_t preflen, optlen;
if (audio_bug (AUDIO_FUNC, !prefix)) { if (audio_bug(__func__, !prefix)) {
dolog ("prefix = NULL\n"); dolog ("prefix = NULL\n");
return; return;
} }
if (audio_bug (AUDIO_FUNC, !opt)) { if (audio_bug(__func__, !opt)) {
dolog ("opt = NULL\n"); dolog ("opt = NULL\n");
return; return;
} }
@ -792,7 +792,7 @@ static int audio_attach_capture (HWVoiceOut *hw)
SWVoiceOut *sw; SWVoiceOut *sw;
HWVoiceOut *hw_cap = &cap->hw; HWVoiceOut *hw_cap = &cap->hw;
sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); sc = audio_calloc(__func__, 1, sizeof(*sc));
if (!sc) { if (!sc) {
dolog ("Could not allocate soft capture voice (%zu bytes)\n", dolog ("Could not allocate soft capture voice (%zu bytes)\n",
sizeof (*sc)); sizeof (*sc));
@ -848,7 +848,7 @@ static int audio_pcm_hw_find_min_in (HWVoiceIn *hw)
int audio_pcm_hw_get_live_in (HWVoiceIn *hw) int audio_pcm_hw_get_live_in (HWVoiceIn *hw)
{ {
int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw);
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -886,7 +886,7 @@ static int audio_pcm_sw_get_rpos_in (SWVoiceIn *sw)
int live = hw->total_samples_captured - sw->total_hw_samples_acquired; int live = hw->total_samples_captured - sw->total_hw_samples_acquired;
int rpos; int rpos;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -909,7 +909,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples; rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples;
live = hw->total_samples_captured - sw->total_hw_samples_acquired; live = hw->total_samples_captured - sw->total_hw_samples_acquired;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live_in=%d hw->samples=%d\n", live, hw->samples); dolog ("live_in=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -935,7 +935,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
} }
osamp = swlim; osamp = swlim;
if (audio_bug (AUDIO_FUNC, osamp < 0)) { if (audio_bug(__func__, osamp < 0)) {
dolog ("osamp=%d\n", osamp); dolog ("osamp=%d\n", osamp);
return 0; return 0;
} }
@ -990,7 +990,7 @@ static int audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live)
if (nb_live1) { if (nb_live1) {
int live = smin; int live = smin;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -1014,7 +1014,7 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
hwsamples = sw->hw->samples; hwsamples = sw->hw->samples;
live = sw->total_hw_samples_mixed; live = sw->total_hw_samples_mixed;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hwsamples)){ if (audio_bug(__func__, live < 0 || live > hwsamples)) {
dolog ("live=%d hw->samples=%d\n", live, hwsamples); dolog ("live=%d hw->samples=%d\n", live, hwsamples);
return 0; return 0;
} }
@ -1263,7 +1263,7 @@ static int audio_get_avail (SWVoiceIn *sw)
} }
live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired;
if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { if (audio_bug(__func__, live < 0 || live > sw->hw->samples)) {
dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples);
return 0; return 0;
} }
@ -1287,7 +1287,7 @@ static int audio_get_free (SWVoiceOut *sw)
live = sw->total_hw_samples_mixed; live = sw->total_hw_samples_mixed;
if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { if (audio_bug(__func__, live < 0 || live > sw->hw->samples)) {
dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples);
return 0; return 0;
} }
@ -1354,7 +1354,7 @@ static void audio_run_out (AudioState *s)
live = 0; live = 0;
} }
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
continue; continue;
} }
@ -1389,7 +1389,7 @@ static void audio_run_out (AudioState *s)
prev_rpos = hw->rpos; prev_rpos = hw->rpos;
played = hw->pcm_ops->run_out (hw, live); played = hw->pcm_ops->run_out (hw, live);
replay_audio_out(&played); replay_audio_out(&played);
if (audio_bug (AUDIO_FUNC, hw->rpos >= hw->samples)) { if (audio_bug(__func__, hw->rpos >= hw->samples)) {
dolog ("hw->rpos=%d hw->samples=%d played=%d\n", dolog ("hw->rpos=%d hw->samples=%d played=%d\n",
hw->rpos, hw->samples, played); hw->rpos, hw->samples, played);
hw->rpos = 0; hw->rpos = 0;
@ -1410,7 +1410,7 @@ static void audio_run_out (AudioState *s)
continue; continue;
} }
if (audio_bug (AUDIO_FUNC, played > sw->total_hw_samples_mixed)) { if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) {
dolog ("played=%d sw->total_hw_samples_mixed=%d\n", dolog ("played=%d sw->total_hw_samples_mixed=%d\n",
played, sw->total_hw_samples_mixed); played, sw->total_hw_samples_mixed);
played = sw->total_hw_samples_mixed; played = sw->total_hw_samples_mixed;
@ -1513,7 +1513,7 @@ static void audio_run_capture (AudioState *s)
continue; continue;
} }
if (audio_bug (AUDIO_FUNC, captured > sw->total_hw_samples_mixed)) { if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)) {
dolog ("captured=%d sw->total_hw_samples_mixed=%d\n", dolog ("captured=%d sw->total_hw_samples_mixed=%d\n",
captured, sw->total_hw_samples_mixed); captured, sw->total_hw_samples_mixed);
captured = sw->total_hw_samples_mixed; captured = sw->total_hw_samples_mixed;
@ -1924,7 +1924,7 @@ CaptureVoiceOut *AUD_add_capture (
goto err0; goto err0;
} }
cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); cb = audio_calloc(__func__, 1, sizeof(*cb));
if (!cb) { if (!cb) {
dolog ("Could not allocate capture callback information, size %zu\n", dolog ("Could not allocate capture callback information, size %zu\n",
sizeof (*cb)); sizeof (*cb));
@ -1942,7 +1942,7 @@ CaptureVoiceOut *AUD_add_capture (
HWVoiceOut *hw; HWVoiceOut *hw;
CaptureVoiceOut *cap; CaptureVoiceOut *cap;
cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); cap = audio_calloc(__func__, 1, sizeof(*cap));
if (!cap) { if (!cap) {
dolog ("Could not allocate capture voice, size %zu\n", dolog ("Could not allocate capture voice, size %zu\n",
sizeof (*cap)); sizeof (*cap));
@ -1955,8 +1955,8 @@ CaptureVoiceOut *AUD_add_capture (
/* XXX find a more elegant way */ /* XXX find a more elegant way */
hw->samples = 4096 * 4; hw->samples = 4096 * 4;
hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, hw->mix_buf = audio_calloc(__func__, hw->samples,
sizeof (struct st_sample)); sizeof(struct st_sample));
if (!hw->mix_buf) { if (!hw->mix_buf) {
dolog ("Could not allocate capture mix buffer (%d samples)\n", dolog ("Could not allocate capture mix buffer (%d samples)\n",
hw->samples); hw->samples);
@ -1965,7 +1965,7 @@ CaptureVoiceOut *AUD_add_capture (
audio_pcm_init_info (&hw->info, as); audio_pcm_init_info (&hw->info, as);
cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); cap->buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!cap->buf) { if (!cap->buf) {
dolog ("Could not allocate capture buffer " dolog ("Could not allocate capture buffer "
"(%d samples, each %d bytes)\n", "(%d samples, each %d bytes)\n",

View File

@ -252,10 +252,4 @@ static inline int audio_ring_dist (int dst, int src, int len)
#define AUDIO_STRINGIFY_(n) #n #define AUDIO_STRINGIFY_(n) #n
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n) #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
#if defined _MSC_VER || defined __GNUC__
#define AUDIO_FUNC __FUNCTION__
#else
#define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
#endif
#endif /* QEMU_AUDIO_INT_H */ #endif /* QEMU_AUDIO_INT_H */

View File

@ -31,7 +31,7 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err = sigfillset (&set); err = sigfillset (&set);
if (err) { if (err) {
logerr (p, errno, "%s(%s): sigfillset failed", cap, AUDIO_FUNC); logerr(p, errno, "%s(%s): sigfillset failed", cap, __func__);
return -1; return -1;
} }
@ -57,8 +57,8 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err2 = pthread_sigmask (SIG_SETMASK, &old_set, NULL); err2 = pthread_sigmask (SIG_SETMASK, &old_set, NULL);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_sigmask (restore) failed", logerr(p, err2, "%s(%s): pthread_sigmask (restore) failed",
cap, AUDIO_FUNC); cap, __func__);
/* We have failed to restore original signal mask, all bets are off, /* We have failed to restore original signal mask, all bets are off,
so terminate the process */ so terminate the process */
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -74,17 +74,17 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err2: err2:
err2 = pthread_cond_destroy (&p->cond); err2 = pthread_cond_destroy (&p->cond);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); logerr(p, err2, "%s(%s): pthread_cond_destroy failed", cap, __func__);
} }
err1: err1:
err2 = pthread_mutex_destroy (&p->mutex); err2 = pthread_mutex_destroy (&p->mutex);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); logerr(p, err2, "%s(%s): pthread_mutex_destroy failed", cap, __func__);
} }
err0: err0:
logerr (p, err, "%s(%s): %s failed", cap, AUDIO_FUNC, efunc); logerr(p, err, "%s(%s): %s failed", cap, __func__, efunc);
return -1; return -1;
} }
@ -94,13 +94,13 @@ int audio_pt_fini (struct audio_pt *p, const char *cap)
err = pthread_cond_destroy (&p->cond); err = pthread_cond_destroy (&p->cond);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_destroy failed", cap, __func__);
ret = -1; ret = -1;
} }
err = pthread_mutex_destroy (&p->mutex); err = pthread_mutex_destroy (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_destroy failed", cap, __func__);
ret = -1; ret = -1;
} }
return ret; return ret;
@ -112,7 +112,7 @@ int audio_pt_lock (struct audio_pt *p, const char *cap)
err = pthread_mutex_lock (&p->mutex); err = pthread_mutex_lock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_lock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_lock failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -124,7 +124,7 @@ int audio_pt_unlock (struct audio_pt *p, const char *cap)
err = pthread_mutex_unlock (&p->mutex); err = pthread_mutex_unlock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_unlock failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -136,7 +136,7 @@ int audio_pt_wait (struct audio_pt *p, const char *cap)
err = pthread_cond_wait (&p->cond, &p->mutex); err = pthread_cond_wait (&p->cond, &p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_wait failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_wait failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -148,12 +148,12 @@ int audio_pt_unlock_and_signal (struct audio_pt *p, const char *cap)
err = pthread_mutex_unlock (&p->mutex); err = pthread_mutex_unlock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_unlock failed", cap, __func__);
return -1; return -1;
} }
err = pthread_cond_signal (&p->cond); err = pthread_cond_signal (&p->cond);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_signal failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_signal failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -166,7 +166,7 @@ int audio_pt_join (struct audio_pt *p, void **arg, const char *cap)
err = pthread_join (p->thread, &ret); err = pthread_join (p->thread, &ret);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_join failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_join failed", cap, __func__);
return -1; return -1;
} }
*arg = ret; *arg = ret;

View File

@ -57,13 +57,13 @@ static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
glue (s->nb_hw_voices_, TYPE) = max_voices; glue (s->nb_hw_voices_, TYPE) = max_voices;
} }
if (audio_bug (AUDIO_FUNC, !voice_size && max_voices)) { if (audio_bug(__func__, !voice_size && max_voices)) {
dolog ("drv=`%s' voice_size=0 max_voices=%d\n", dolog ("drv=`%s' voice_size=0 max_voices=%d\n",
drv->name, max_voices); drv->name, max_voices);
glue (s->nb_hw_voices_, TYPE) = 0; glue (s->nb_hw_voices_, TYPE) = 0;
} }
if (audio_bug (AUDIO_FUNC, voice_size && !max_voices)) { if (audio_bug(__func__, voice_size && !max_voices)) {
dolog ("drv=`%s' voice_size=%d max_voices=0\n", dolog ("drv=`%s' voice_size=%d max_voices=0\n",
drv->name, voice_size); drv->name, voice_size);
} }
@ -77,7 +77,7 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw) static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
{ {
HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample)); HWBUF = audio_calloc(__func__, hw->samples, sizeof(struct st_sample));
if (!HWBUF) { if (!HWBUF) {
dolog ("Could not allocate " NAME " buffer (%d samples)\n", dolog ("Could not allocate " NAME " buffer (%d samples)\n",
hw->samples); hw->samples);
@ -105,7 +105,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
samples = ((int64_t) sw->hw->samples << 32) / sw->ratio; samples = ((int64_t) sw->hw->samples << 32) / sw->ratio;
sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (struct st_sample)); sw->buf = audio_calloc(__func__, samples, sizeof(struct st_sample));
if (!sw->buf) { if (!sw->buf) {
dolog ("Could not allocate buffer for `%s' (%d samples)\n", dolog ("Could not allocate buffer for `%s' (%d samples)\n",
SW_NAME (sw), samples); SW_NAME (sw), samples);
@ -238,17 +238,17 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
return NULL; return NULL;
} }
if (audio_bug (AUDIO_FUNC, !drv)) { if (audio_bug(__func__, !drv)) {
dolog ("No host audio driver\n"); dolog ("No host audio driver\n");
return NULL; return NULL;
} }
if (audio_bug (AUDIO_FUNC, !drv->pcm_ops)) { if (audio_bug(__func__, !drv->pcm_ops)) {
dolog ("Host audio driver without pcm_ops\n"); dolog ("Host audio driver without pcm_ops\n");
return NULL; return NULL;
} }
hw = audio_calloc (AUDIO_FUNC, 1, glue (drv->voice_size_, TYPE)); hw = audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE));
if (!hw) { if (!hw) {
dolog ("Can not allocate voice `%s' size %d\n", dolog ("Can not allocate voice `%s' size %d\n",
drv->name, glue (drv->voice_size_, TYPE)); drv->name, glue (drv->voice_size_, TYPE));
@ -266,7 +266,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
goto err0; goto err0;
} }
if (audio_bug (AUDIO_FUNC, hw->samples <= 0)) { if (audio_bug(__func__, hw->samples <= 0)) {
dolog ("hw->samples=%d\n", hw->samples); dolog ("hw->samples=%d\n", hw->samples);
goto err1; goto err1;
} }
@ -339,7 +339,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
hw_as = *as; hw_as = *as;
} }
sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); sw = audio_calloc(__func__, 1, sizeof(*sw));
if (!sw) { if (!sw) {
dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", dolog ("Could not allocate soft voice `%s' (%zu bytes)\n",
sw_name ? sw_name : "unknown", sizeof (*sw)); sw_name ? sw_name : "unknown", sizeof (*sw));
@ -379,7 +379,7 @@ static void glue (audio_close_, TYPE) (SW *sw)
void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw)
{ {
if (sw) { if (sw) {
if (audio_bug (AUDIO_FUNC, !card)) { if (audio_bug(__func__, !card)) {
dolog ("card=%p\n", card); dolog ("card=%p\n", card);
return; return;
} }
@ -399,7 +399,7 @@ SW *glue (AUD_open_, TYPE) (
{ {
AudioState *s = &glob_audio_state; AudioState *s = &glob_audio_state;
if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) { if (audio_bug(__func__, !card || !name || !callback_fn || !as)) {
dolog ("card=%p name=%p callback_fn=%p as=%p\n", dolog ("card=%p name=%p callback_fn=%p as=%p\n",
card, name, callback_fn, as); card, name, callback_fn, as);
goto fail; goto fail;
@ -408,12 +408,12 @@ SW *glue (AUD_open_, TYPE) (
ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
name, as->freq, as->nchannels, as->fmt); name, as->freq, as->nchannels, as->fmt);
if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) { if (audio_bug(__func__, audio_validate_settings(as))) {
audio_print_settings (as); audio_print_settings (as);
goto fail; goto fail;
} }
if (audio_bug (AUDIO_FUNC, !s->drv)) { if (audio_bug(__func__, !s->drv)) {
dolog ("Can not open `%s' (no host audio driver)\n", name); dolog ("Can not open `%s' (no host audio driver)\n", name);
goto fail; goto fail;
} }

View File

@ -543,7 +543,7 @@ static int dsound_run_out (HWVoiceOut *hw, int live)
} }
} }
if (audio_bug (AUDIO_FUNC, len < 0 || len > bufsize)) { if (audio_bug(__func__, len < 0 || len > bufsize)) {
dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n", dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n",
len, bufsize, old_pos, ppos); len, bufsize, old_pos, ppos);
return 0; return 0;

View File

@ -344,7 +344,7 @@ struct rate {
*/ */
void *st_rate_start (int inrate, int outrate) void *st_rate_start (int inrate, int outrate)
{ {
struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate)); struct rate *rate = audio_calloc(__func__, 1, sizeof(*rate));
if (!rate) { if (!rate) {
dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate)); dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate));

View File

@ -582,11 +582,9 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as,
} }
if (!oss->mmapped) { if (!oss->mmapped) {
oss->pcm_buf = audio_calloc ( oss->pcm_buf = audio_calloc(__func__,
AUDIO_FUNC, hw->samples,
hw->samples, 1 << hw->info.shift);
1 << hw->info.shift
);
if (!oss->pcm_buf) { if (!oss->pcm_buf) {
dolog ( dolog (
"Could not allocate DAC buffer (%d samples, each %d bytes)\n", "Could not allocate DAC buffer (%d samples, each %d bytes)\n",
@ -705,7 +703,7 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
} }
hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift; hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); oss->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!oss->pcm_buf) { if (!oss->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);

View File

@ -206,7 +206,7 @@ static void *qpa_thread_out (void *arg)
PAVoiceOut *pa = arg; PAVoiceOut *pa = arg;
HWVoiceOut *hw = &pa->hw; HWVoiceOut *hw = &pa->hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -222,7 +222,7 @@ static void *qpa_thread_out (void *arg)
break; break;
} }
if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { if (audio_pt_wait(&pa->pt, __func__)) {
goto exit; goto exit;
} }
} }
@ -230,7 +230,7 @@ static void *qpa_thread_out (void *arg)
decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2); decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2);
rpos = pa->rpos; rpos = pa->rpos;
if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_unlock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -251,7 +251,7 @@ static void *qpa_thread_out (void *arg)
to_mix -= chunk; to_mix -= chunk;
} }
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -261,7 +261,7 @@ static void *qpa_thread_out (void *arg)
} }
exit: exit:
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
return NULL; return NULL;
} }
@ -270,7 +270,7 @@ static int qpa_run_out (HWVoiceOut *hw, int live)
int decr; int decr;
PAVoiceOut *pa = (PAVoiceOut *) hw; PAVoiceOut *pa = (PAVoiceOut *) hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return 0; return 0;
} }
@ -279,10 +279,10 @@ static int qpa_run_out (HWVoiceOut *hw, int live)
pa->live = live - decr; pa->live = live - decr;
hw->rpos = pa->rpos; hw->rpos = pa->rpos;
if (pa->live > 0) { if (pa->live > 0) {
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
} }
else { else {
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
} }
return decr; return decr;
} }
@ -298,7 +298,7 @@ static void *qpa_thread_in (void *arg)
PAVoiceIn *pa = arg; PAVoiceIn *pa = arg;
HWVoiceIn *hw = &pa->hw; HWVoiceIn *hw = &pa->hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -314,7 +314,7 @@ static void *qpa_thread_in (void *arg)
break; break;
} }
if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { if (audio_pt_wait(&pa->pt, __func__)) {
goto exit; goto exit;
} }
} }
@ -322,7 +322,7 @@ static void *qpa_thread_in (void *arg)
incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2); incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2);
wpos = pa->wpos; wpos = pa->wpos;
if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_unlock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -342,7 +342,7 @@ static void *qpa_thread_in (void *arg)
to_grab -= chunk; to_grab -= chunk;
} }
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -352,7 +352,7 @@ static void *qpa_thread_in (void *arg)
} }
exit: exit:
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
return NULL; return NULL;
} }
@ -361,7 +361,7 @@ static int qpa_run_in (HWVoiceIn *hw)
int live, incr, dead; int live, incr, dead;
PAVoiceIn *pa = (PAVoiceIn *) hw; PAVoiceIn *pa = (PAVoiceIn *) hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return 0; return 0;
} }
@ -372,10 +372,10 @@ static int qpa_run_in (HWVoiceIn *hw)
pa->dead = dead - incr; pa->dead = dead - incr;
hw->wpos = pa->wpos; hw->wpos = pa->wpos;
if (pa->dead > 0) { if (pa->dead > 0) {
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
} }
else { else {
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
} }
return incr; return incr;
} }
@ -579,7 +579,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = g->conf.samples; hw->samples = g->conf.samples;
pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); pa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
pa->rpos = hw->rpos; pa->rpos = hw->rpos;
if (!pa->pcm_buf) { if (!pa->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
@ -587,7 +587,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,
goto fail2; goto fail2;
} }
if (audio_pt_init (&pa->pt, qpa_thread_out, hw, AUDIO_CAP, AUDIO_FUNC)) { if (audio_pt_init(&pa->pt, qpa_thread_out, hw, AUDIO_CAP, __func__)) {
goto fail3; goto fail3;
} }
@ -636,7 +636,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = g->conf.samples; hw->samples = g->conf.samples;
pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); pa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
pa->wpos = hw->wpos; pa->wpos = hw->wpos;
if (!pa->pcm_buf) { if (!pa->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
@ -644,7 +644,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
goto fail2; goto fail2;
} }
if (audio_pt_init (&pa->pt, qpa_thread_in, hw, AUDIO_CAP, AUDIO_FUNC)) { if (audio_pt_init(&pa->pt, qpa_thread_in, hw, AUDIO_CAP, __func__)) {
goto fail3; goto fail3;
} }
@ -667,17 +667,17 @@ static void qpa_fini_out (HWVoiceOut *hw)
void *ret; void *ret;
PAVoiceOut *pa = (PAVoiceOut *) hw; PAVoiceOut *pa = (PAVoiceOut *) hw;
audio_pt_lock (&pa->pt, AUDIO_FUNC); audio_pt_lock(&pa->pt, __func__);
pa->done = 1; pa->done = 1;
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); audio_pt_join(&pa->pt, &ret, __func__);
if (pa->stream) { if (pa->stream) {
pa_stream_unref (pa->stream); pa_stream_unref (pa->stream);
pa->stream = NULL; pa->stream = NULL;
} }
audio_pt_fini (&pa->pt, AUDIO_FUNC); audio_pt_fini(&pa->pt, __func__);
g_free (pa->pcm_buf); g_free (pa->pcm_buf);
pa->pcm_buf = NULL; pa->pcm_buf = NULL;
} }
@ -687,17 +687,17 @@ static void qpa_fini_in (HWVoiceIn *hw)
void *ret; void *ret;
PAVoiceIn *pa = (PAVoiceIn *) hw; PAVoiceIn *pa = (PAVoiceIn *) hw;
audio_pt_lock (&pa->pt, AUDIO_FUNC); audio_pt_lock(&pa->pt, __func__);
pa->done = 1; pa->done = 1;
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); audio_pt_join(&pa->pt, &ret, __func__);
if (pa->stream) { if (pa->stream) {
pa_stream_unref (pa->stream); pa_stream_unref (pa->stream);
pa->stream = NULL; pa->stream = NULL;
} }
audio_pt_fini (&pa->pt, AUDIO_FUNC); audio_pt_fini(&pa->pt, __func__);
g_free (pa->pcm_buf); g_free (pa->pcm_buf);
pa->pcm_buf = NULL; pa->pcm_buf = NULL;
} }

View File

@ -277,7 +277,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
return; return;
} }
if (audio_bug (AUDIO_FUNC, sdl->live < 0 || sdl->live > hw->samples)) { if (audio_bug(__func__, sdl->live < 0 || sdl->live > hw->samples)) {
dolog ("sdl->live=%d hw->samples=%d\n", dolog ("sdl->live=%d hw->samples=%d\n",
sdl->live, hw->samples); sdl->live, hw->samples);
return; return;

View File

@ -139,7 +139,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &wav_as); audio_pcm_init_info (&hw->info, &wav_as);
hw->samples = 1024; hw->samples = 1024;
wav->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); wav->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!wav->pcm_buf) { if (!wav->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
hw->samples << hw->info.shift); hw->samples << hw->info.shift);