diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2016-07-14 23:07:31 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-07-14 16:33:49 +0200 |
commit | 6fdaad70afb6c04a03ba48c111304467daa330b1 (patch) | |
tree | fc1359a9568223cc1c976924f1bc3038bcd8a5b4 | |
parent | 757c45b2ae3dddc23566f2dc511bf606607da000 (diff) | |
download | alsa-lib-6fdaad70afb6c04a03ba48c111304467daa330b1.tar.gz |
pcm: remove alloca() from snd_pcm_query_chmaps_from_hw()
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/pcm/pcm_hw.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 864d5fa2..e7a23939 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -1094,7 +1094,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, snd_pcm_stream_t stream) { snd_ctl_t *ctl; - snd_ctl_elem_id_t *id; + snd_ctl_elem_id_t id = {0}; unsigned int tlv[2048], *start; snd_pcm_chmap_query_t **map; int i, ret, nums; @@ -1105,9 +1105,8 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, return NULL; } - snd_ctl_elem_id_alloca(&id); - __fill_chmap_ctl_id(id, dev, subdev, stream); - ret = snd_ctl_elem_tlv_read(ctl, id, tlv, sizeof(tlv)); + __fill_chmap_ctl_id(&id, dev, subdev, stream); + ret = snd_ctl_elem_tlv_read(ctl, &id, tlv, sizeof(tlv)); snd_ctl_close(ctl); if (ret < 0) { SYSMSG("Cannot read Channel Map TLV\n"); |