aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ini.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ini.c b/src/ini.c
index 0b61b1b..e34088e 100644
--- a/src/ini.c
+++ b/src/ini.c
@@ -273,9 +273,9 @@ struct INIFILE *ini_open(const char *filename) {
}
}
// Find pointer to first comment character
- if (!reading_value) {
- char *comment = strpbrk(line, ";#");
- if (comment) {
+ char *comment = strpbrk(line, ";#");
+ if (comment) {
+ if (!reading_value || line - comment == 0) {
// Remove comment from line (standalone and inline comments)
if (!((comment - line > 0 && (*(comment - 1) == '\\')) || (*comment - 1) == '#')) {
*comment = '\0';