From dc6e4e80c0b0a3950594e32db7cff1b2db24d75c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 1 Nov 2020 11:19:51 -0500 Subject: Implement URL rewrites with regex capture groups --- src/ini.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/ini.c') 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 */ -- cgit v1.2.3