music: Tweak comment parsing for substitute configs.
Allow comments to be attached to the end of configuration lines, as well as being specified on a line on their own.
This commit is contained in:
parent
9ec075b024
commit
869e52062b
1 changed files with 14 additions and 2 deletions
|
|
@ -520,11 +520,23 @@ static char *ParseSubstituteLine(char *filename, char *line)
|
||||||
char *p;
|
char *p;
|
||||||
int hash_index;
|
int hash_index;
|
||||||
|
|
||||||
|
// Strip out comments if present.
|
||||||
|
p = strchr(line, '#');
|
||||||
|
if (p != NULL)
|
||||||
|
{
|
||||||
|
while (p > line && isspace(*(p - 1)))
|
||||||
|
{
|
||||||
|
--p;
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
// Skip leading spaces.
|
// Skip leading spaces.
|
||||||
for (p = line; *p != '\0' && isspace(*p); ++p);
|
for (p = line; *p != '\0' && isspace(*p); ++p);
|
||||||
|
|
||||||
// Comment or empty line? This is valid syntax, so just return success.
|
// Empty line? This includes comment lines now that comments have
|
||||||
if (*p == '#' || *p == '\0')
|
// been stripped.
|
||||||
|
if (*p == '\0')
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue