Following to basic principles of C language programing.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- amixer/amixer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/amixer/amixer.c b/amixer/amixer.c index 36c92eb..ff1a927 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -1278,13 +1278,16 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv) { - unsigned int idx, item = 0; + unsigned int idx; + unsigned int item = 0; int check_flag = ignore_error ? 0 : -1; + int ival; + char *ptr;
for (idx = 1; idx < argc; idx++) { - char *ptr = argv[idx]; + ptr = argv[idx]; while (*ptr) { - int ival = get_enum_item_index(elem, &ptr); + ival = get_enum_item_index(elem, &ptr); if (ival < 0) return check_flag; if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)