summaryrefslogtreecommitdiffstats
path: root/src/ini.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-11-01 11:19:51 -0500
committerDrew DeVault <sir@cmpwn.com>2020-11-01 11:19:51 -0500
commitdc6e4e80c0b0a3950594e32db7cff1b2db24d75c (patch)
treeddbec0d5be083daa32f05acdcce25a31489ec999 /src/ini.c
parent953039e0b15df9c119b70eb18f36e580a4c4e7d4 (diff)
downloadgmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.gz
gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.xz
gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.zip
Implement URL rewrites with regex capture groups
Diffstat (limited to 'src/ini.c')
-rw-r--r--src/ini.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/ini.c b/src/ini.c
index 88ff0d1..a001101 100644
--- a/src/ini.c
+++ b/src/ini.c
@@ -45,18 +45,9 @@ static char* lskip(const char* s)
be prefixed by a whitespace character to register as a comment. */
static char* find_chars_or_comment(const char* s, const char* chars)
{
-#if INI_ALLOW_INLINE_COMMENTS
- int was_space = 0;
- while (*s && (!chars || !strchr(chars, *s)) &&
- !(was_space && strchr(INI_INLINE_COMMENT_PREFIXES, *s))) {
- was_space = isspace((unsigned char)(*s));
- s++;
- }
-#else
while (*s && (!chars || !strchr(chars, *s))) {
s++;
}
-#endif
return (char*)s;
}
@@ -123,7 +114,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
#endif
else if (*start == '[') {
/* A "[section]" line */
- end = find_chars_or_comment(start + 1, "]");
+ end = strrchr(start + 1, ']');
if (*end == ']') {
*end = '\0';
strncpy0(section, start + 1, sizeof(section));
@@ -141,11 +132,6 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
*end = '\0';
name = rstrip(start);
value = lskip(end + 1);
-#if INI_ALLOW_INLINE_COMMENTS
- end = find_chars_or_comment(value, NULL);
- if (*end)
- *end = '\0';
-#endif
rstrip(value);
/* Valid name[=:]value pair found, call handler */