mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
conf: remove alloca() from snd_func_private_pcm_subdevice()
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
e26ee8dff6
commit
68e659bb23
1 changed files with 4 additions and 4 deletions
|
|
@ -1162,7 +1162,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVA
|
|||
int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
|
||||
snd_config_t *src, snd_config_t *private_data)
|
||||
{
|
||||
snd_pcm_info_t *info;
|
||||
snd_pcm_info_t info = {0};
|
||||
const char *id;
|
||||
const void *data;
|
||||
snd_pcm_t *pcm;
|
||||
|
|
@ -1181,15 +1181,15 @@ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIB
|
|||
SNDERR("field pcm_handle is not a pointer");
|
||||
return err;
|
||||
}
|
||||
snd_pcm_info_alloca(&info);
|
||||
err = snd_pcm_info(pcm, info);
|
||||
err = snd_pcm_info(pcm, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
if (err >= 0)
|
||||
err = snd_config_imake_integer(dst, id, snd_pcm_info_get_subdevice(info));
|
||||
err = snd_config_imake_integer(dst, id,
|
||||
snd_pcm_info_get_subdevice(&info));
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue