Extract a quoted string value from position. Handles both "..." and '...' * Returns heap-allocated string, or NULL. */
| 219 | /* Extract a quoted string value from position. Handles both "..." and '...' |
| 220 | * Returns heap-allocated string, or NULL. */ |
| 221 | static char *extract_quoted(const char *p, const char *end) { |
| 222 | /* Skip whitespace and = sign */ |
| 223 | while (p < end && (*p == ' ' || *p == '\t' || *p == '=')) { |
| 224 | p++; |
| 225 | } |
| 226 | if (p >= end) { |
| 227 | return NULL; |
| 228 | } |
| 229 | char quote = *p; |
| 230 | if (quote != '"' && quote != '\'') { |
| 231 | return NULL; |
| 232 | } |
| 233 | p++; |
| 234 | const char *start = p; |
| 235 | while (p < end && *p != quote && *p != '\n') { |
| 236 | p++; |
| 237 | } |
| 238 | if (p >= end || *p != quote) { |
| 239 | return NULL; |
| 240 | } |
| 241 | return cbm_strndup(start, (size_t)(p - start)); |
| 242 | } |
| 243 | |
| 244 | /* ── Language-specific manifest parsers ────────────────────────── */ |
| 245 |
no test coverage detected