| 943 | } |
| 944 | |
| 945 | static int get_extended_base_var(struct config_source *cs, struct strbuf *name, |
| 946 | int c) |
| 947 | { |
| 948 | cs->subsection_case_sensitive = 0; |
| 949 | do { |
| 950 | if (c == '\n') |
| 951 | goto error_incomplete_line; |
| 952 | c = get_next_char(cs); |
| 953 | } while (isspace(c)); |
| 954 | |
| 955 | /* We require the format to be '[base "extension"]' */ |
| 956 | if (c != '"') |
| 957 | return -1; |
| 958 | strbuf_addch(name, '.'); |
| 959 | |
| 960 | for (;;) { |
| 961 | int c = get_next_char(cs); |
| 962 | if (c == '\n') |
| 963 | goto error_incomplete_line; |
| 964 | if (c == '"') |
| 965 | break; |
| 966 | if (c == '\\') { |
| 967 | c = get_next_char(cs); |
| 968 | if (c == '\n') |
| 969 | goto error_incomplete_line; |
| 970 | } |
| 971 | strbuf_addch(name, c); |
| 972 | } |
| 973 | |
| 974 | /* Final ']' */ |
| 975 | if (get_next_char(cs) != ']') |
| 976 | return -1; |
| 977 | return 0; |
| 978 | error_incomplete_line: |
| 979 | cs->linenr--; |
| 980 | return -1; |
| 981 | } |
| 982 | |
| 983 | static int get_base_var(struct config_source *cs, struct strbuf *name) |
| 984 | { |
no test coverage detected