mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-10 13:30:01 -05:00
pcm: remove alloca() from snd_pcm_get_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
8c3ffab39e
commit
f889a8d5de
1 changed files with 4 additions and 5 deletions
|
|
@ -8476,17 +8476,16 @@ int snd_pcm_get_params(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t *buffer_size,
|
||||
snd_pcm_uframes_t *period_size)
|
||||
{
|
||||
snd_pcm_hw_params_t *hw;
|
||||
snd_pcm_hw_params_t params = {0};
|
||||
int err;
|
||||
|
||||
assert(pcm);
|
||||
snd_pcm_hw_params_alloca(&hw);
|
||||
err = snd_pcm_hw_params_current(pcm, hw);
|
||||
err = snd_pcm_hw_params_current(pcm, ¶ms);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(hw, buffer_size);
|
||||
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(¶ms, buffer_size);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return INTERNAL(snd_pcm_hw_params_get_period_size)(hw, period_size,
|
||||
return INTERNAL(snd_pcm_hw_params_get_period_size)(¶ms, period_size,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue