mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-12 05:33:44 -04:00
conf: List cases in range explicitly
Case ranges are a GNU extension, and provide only a slight readability improvement. Signed-off-by: Michael Forney <mforney@mforney.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
0baf7b377c
commit
e0978ba69d
1 changed files with 12 additions and 10 deletions
22
src/conf.c
22
src/conf.c
|
|
@ -888,7 +888,8 @@ static int get_quotedchar(input_t *input)
|
||||||
return '\r';
|
return '\r';
|
||||||
case 'f':
|
case 'f':
|
||||||
return '\f';
|
return '\f';
|
||||||
case '0' ... '7':
|
case '0': case '1': case '2': case '3':
|
||||||
|
case '4': case '5': case '6': case '7':
|
||||||
{
|
{
|
||||||
int num = c - '0';
|
int num = c - '0';
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
@ -1479,7 +1480,8 @@ static void string_print(char *str, int id, snd_output_t *out)
|
||||||
}
|
}
|
||||||
if (!id) {
|
if (!id) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case '0' ... '9':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
case '-':
|
case '-':
|
||||||
goto quoted;
|
goto quoted;
|
||||||
}
|
}
|
||||||
|
|
@ -1488,8 +1490,6 @@ static void string_print(char *str, int id, snd_output_t *out)
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 0:
|
case 0:
|
||||||
goto nonquoted;
|
goto nonquoted;
|
||||||
case 1 ... 31:
|
|
||||||
case 127 ... 255:
|
|
||||||
case ' ':
|
case ' ':
|
||||||
case '=':
|
case '=':
|
||||||
case ';':
|
case ';':
|
||||||
|
|
@ -1501,6 +1501,8 @@ static void string_print(char *str, int id, snd_output_t *out)
|
||||||
case '"':
|
case '"':
|
||||||
goto quoted;
|
goto quoted;
|
||||||
default:
|
default:
|
||||||
|
if (*p <= 31 || *p >= 127)
|
||||||
|
goto quoted;
|
||||||
p++;
|
p++;
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
@ -1542,12 +1544,11 @@ static void string_print(char *str, int id, snd_output_t *out)
|
||||||
snd_output_putc(out, '\\');
|
snd_output_putc(out, '\\');
|
||||||
snd_output_putc(out, c);
|
snd_output_putc(out, c);
|
||||||
break;
|
break;
|
||||||
case 32 ... '\'' - 1:
|
|
||||||
case '\'' + 1 ... 126:
|
|
||||||
snd_output_putc(out, c);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
snd_output_printf(out, "\\%04o", c);
|
if (c >= 32 && c <= 126 && c != '\'')
|
||||||
|
snd_output_putc(out, c);
|
||||||
|
else
|
||||||
|
snd_output_printf(out, "\\%04o", c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
|
|
@ -4687,7 +4688,8 @@ static int parse_char(const char **ptr)
|
||||||
case 'f':
|
case 'f':
|
||||||
c = '\f';
|
c = '\f';
|
||||||
break;
|
break;
|
||||||
case '0' ... '7':
|
case '0': case '1': case '2': case '3':
|
||||||
|
case '4': case '5': case '6': case '7':
|
||||||
{
|
{
|
||||||
int num = c - '0';
|
int num = c - '0';
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue