| 175 | } |
| 176 | |
| 177 | static void strip_inline_comment(char *s) { |
| 178 | bool in_quote = false; |
| 179 | char quote = '\0'; |
| 180 | for (char *p = s; *p; p++) { |
| 181 | if ((*p == '"' || *p == '\'') && (p == s || p[-1] != '\\')) { |
| 182 | if (!in_quote) { |
| 183 | in_quote = true; |
| 184 | quote = *p; |
| 185 | } else if (*p == quote) { |
| 186 | in_quote = false; |
| 187 | } |
| 188 | continue; |
| 189 | } |
| 190 | if (!in_quote && (*p == '#' || *p == ';') && (p == s || isspace((unsigned char)p[-1]))) { |
| 191 | *p = '\0'; |
| 192 | return; |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | static char *strip_matching_quotes(char *s) { |
| 198 | size_t len = strlen(s); |
no outgoing calls
no test coverage detected