diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-11-21 10:57:01 -0500 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-11-21 10:57:01 -0500 | 
| commit | f4c3d1318dd3c62a5af4099ef7624f49b5b2a4b4 (patch) | |
| tree | e53f6ccbd054451b6104fedc422a617e5ae13536 /src | |
| parent | 0b3626f51fe55ebb7dab54abea2c7241430d1f58 (diff) | |
| download | stasis-f4c3d1318dd3c62a5af4099ef7624f49b5b2a4b4.tar.gz | |
Bugfix: Test for a comment first, then act accordingly, instead of testing only when a variable is being read
Diffstat (limited to 'src')
| -rw-r--r-- | src/ini.c | 6 | 
1 files changed, 3 insertions, 3 deletions
| @@ -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'; | 
