mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
pcm: remove alloca() from snd_pcm_direct_set_timer_params
Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
8bb090be05
commit
f7c60897d9
1 changed files with 6 additions and 7 deletions
|
|
@ -1358,21 +1358,20 @@ int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix,
|
|||
|
||||
int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
|
||||
{
|
||||
snd_timer_params_t *params;
|
||||
snd_timer_params_t params = {0};
|
||||
unsigned int filter;
|
||||
int ret;
|
||||
|
||||
snd_timer_params_alloca(¶ms);
|
||||
snd_timer_params_set_auto_start(params, 1);
|
||||
snd_timer_params_set_auto_start(¶ms, 1);
|
||||
if (dmix->type != SND_PCM_TYPE_DSNOOP)
|
||||
snd_timer_params_set_early_event(params, 1);
|
||||
snd_timer_params_set_ticks(params, 1);
|
||||
snd_timer_params_set_early_event(¶ms, 1);
|
||||
snd_timer_params_set_ticks(¶ms, 1);
|
||||
if (dmix->tread) {
|
||||
filter = (1<<SND_TIMER_EVENT_TICK) |
|
||||
dmix->timer_events;
|
||||
snd_timer_params_set_filter(params, filter);
|
||||
snd_timer_params_set_filter(¶ms, filter);
|
||||
}
|
||||
ret = snd_timer_params(dmix->timer, params);
|
||||
ret = snd_timer_params(dmix->timer, ¶ms);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set timer parameters");
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue