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 --- src/pcm/pcm_direct.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index 50d5539..c3925cc 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -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;