| 3555 | } |
| 3556 | |
| 3557 | int parse_config_key(const char *var, |
| 3558 | const char *section, |
| 3559 | const char **subsection, size_t *subsection_len, |
| 3560 | const char **key) |
| 3561 | { |
| 3562 | const char *dot; |
| 3563 | |
| 3564 | /* Does it start with "section." ? */ |
| 3565 | if (!skip_prefix(var, section, &var) || *var != '.') |
| 3566 | return -1; |
| 3567 | |
| 3568 | /* |
| 3569 | * Find the key; we don't know yet if we have a subsection, but we must |
| 3570 | * parse backwards from the end, since the subsection may have dots in |
| 3571 | * it, too. |
| 3572 | */ |
| 3573 | dot = strrchr(var, '.'); |
| 3574 | *key = dot + 1; |
| 3575 | |
| 3576 | /* Did we have a subsection at all? */ |
| 3577 | if (dot == var) { |
| 3578 | if (subsection) { |
| 3579 | *subsection = NULL; |
| 3580 | *subsection_len = 0; |
| 3581 | } |
| 3582 | } |
| 3583 | else { |
| 3584 | if (!subsection) |
| 3585 | return -1; |
| 3586 | *subsection = var + 1; |
| 3587 | *subsection_len = dot - *subsection; |
| 3588 | } |
| 3589 | |
| 3590 | return 0; |
| 3591 | } |
| 3592 | |
| 3593 | const char *config_origin_type_name(enum config_origin_type type) |
| 3594 | { |
no outgoing calls
no test coverage detected