summaryrefslogtreecommitdiff
path: root/src/configparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 6fdc56c32..4748fa847 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -158,12 +158,20 @@ struct Parser
}
}
+ bool wordchar(char ch)
+ {
+ return isalnum(ch)
+ || ch == '-'
+ || ch == '.'
+ || ch == '_';
+ }
+
void nextword(std::string& rv)
{
int ch = next();
while (isspace(ch))
ch = next();
- while (isalnum(ch) || ch == '_'|| ch == '-')
+ while (wordchar(ch))
{
rv.push_back(ch);
ch = next();
@@ -205,7 +213,7 @@ struct Parser
while (1)
{
ch = next();
- if (isalnum(ch) || (varname.empty() && ch == '#') || ch == '.')
+ if (wordchar(ch) || (varname.empty() && ch == '#'))
varname.push_back(ch);
else if (ch == ';')
break;