[alsa-devel] [PATCH RFC 10/21] ALSA: pcm: constify function local and read-only table
Takashi Sakamoto
o-takashi at sakamocchi.jp
Sun May 14 10:57:45 CEST 2017
In a function snd_pcm_hw_params_choose(), target parameters are arranged
into a table. Though each entry of this table is read-only, they don't
have const qualifier.
This commit adds the qualifier.
Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
sound/core/pcm_lib.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 5088d4b..0ab6f86 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1733,7 +1733,7 @@ EXPORT_SYMBOL(snd_pcm_hw_param_last);
int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params)
{
- static int vars[] = {
+ static const int vars[] = {
SNDRV_PCM_HW_PARAM_ACCESS,
SNDRV_PCM_HW_PARAM_FORMAT,
SNDRV_PCM_HW_PARAM_SUBFORMAT,
@@ -1744,7 +1744,8 @@ int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
SNDRV_PCM_HW_PARAM_TICK_TIME,
-1
};
- int err, *v;
+ const int *v;
+ int err;
for (v = vars; *v != -1; v++) {
if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
--
2.9.3
More information about the Alsa-devel
mailing list