diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2016-07-14 23:07:45 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-07-14 16:33:52 +0200 |
commit | 68e659bb232dc5ad71432175735a44d3d4765176 (patch) | |
tree | ee8f4c8b1fb5093e2f8129e427751043da25fbb7 | |
parent | e26ee8dff6b0ecefc17d12ee1899abecc0097429 (diff) | |
download | alsa-lib-68e659bb232dc5ad71432175735a44d3d4765176.tar.gz |
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>
-rw-r--r-- | src/confmisc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/confmisc.c b/src/confmisc.c index 99be48b8..a985f143 100644 --- a/src/confmisc.c +++ b/src/confmisc.c @@ -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 |