Extract "name" value from a TOML section. Scans from section_start until * the next [...] header or EOF. Returns heap string or NULL. */
| 348 | /* Extract "name" value from a TOML section. Scans from section_start until |
| 349 | * the next [...] header or EOF. Returns heap string or NULL. */ |
| 350 | static char *toml_extract_name(const char *section_start, const char *end) { |
| 351 | const char *p = section_start; |
| 352 | while (p < end) { |
| 353 | while (p < end && (*p == ' ' || *p == '\t')) { |
| 354 | p++; |
| 355 | } |
| 356 | if (p < end && *p == '[') { |
| 357 | break; |
| 358 | } |
| 359 | if (at_prefix(p, end, "name ", TOML_NAME_SP)) { |
| 360 | return extract_quoted(p + TOML_NAME_SP, end); |
| 361 | } |
| 362 | if (at_prefix(p, end, "name=", TOML_NAME_EQ)) { |
| 363 | return extract_quoted(p + TOML_NAME_EQ, end); |
| 364 | } |
| 365 | while (p < end && *p != '\n') { |
| 366 | p++; |
| 367 | } |
| 368 | if (p < end) { |
| 369 | p++; |
| 370 | } |
| 371 | } |
| 372 | return NULL; |
| 373 | } |
| 374 | |
| 375 | /* Build entry path: dir/suffix or just suffix if dir is empty. */ |
| 376 | static char *build_entry_path(const char *rel_path, const char *suffix) { |
no test coverage detected