mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
ctl: use automatic variable instead of call of alloca(3)
Inner this library, layouts of all structures are public. At a compilation time, each size of the structures can be calculated. It means that we can use automatic variable instead of calling alloca(3) to program this library because in both ways storages are kept on stack frame of process VMA. Besides, the usage of automatic variables requires less instructions than calls of alloca(3). Furthermore, alloca(3) is not described in any C language standards. This commit replaces calls of alloca(3) just for structures with automatic variables, for control features. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
7bc886584f
commit
06a51e29f4
5 changed files with 122 additions and 140 deletions
|
|
@ -252,13 +252,12 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
{
|
||||
int err;
|
||||
snd_config_iterator_t i, next;
|
||||
snd_ctl_elem_id_t *id;
|
||||
snd_ctl_elem_id_t id = {0};
|
||||
snd_ctl_elem_type_t type;
|
||||
unsigned int count;
|
||||
long v;
|
||||
long idx;
|
||||
snd_ctl_elem_id_alloca(&id);
|
||||
snd_ctl_elem_value_get_id(val, id);
|
||||
snd_ctl_elem_value_get_id(val, &id);
|
||||
count = snd_ctl_elem_info_get_count(info);
|
||||
type = snd_ctl_elem_info_get_type(info);
|
||||
if (count == 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue