| 899 | } |
| 900 | |
| 901 | static int get_value(struct config_source *cs, struct key_value_info *kvi, |
| 902 | config_fn_t fn, void *data, struct strbuf *name) |
| 903 | { |
| 904 | int c; |
| 905 | char *value; |
| 906 | int ret; |
| 907 | struct config_context ctx = { |
| 908 | .kvi = kvi, |
| 909 | }; |
| 910 | |
| 911 | /* Get the full name */ |
| 912 | for (;;) { |
| 913 | c = get_next_char(cs); |
| 914 | if (cs->eof) |
| 915 | break; |
| 916 | if (!iskeychar(c)) |
| 917 | break; |
| 918 | strbuf_addch(name, tolower(c)); |
| 919 | } |
| 920 | |
| 921 | while (c == ' ' || c == '\t') |
| 922 | c = get_next_char(cs); |
| 923 | |
| 924 | value = NULL; |
| 925 | if (c != '\n') { |
| 926 | if (c != '=') |
| 927 | return -1; |
| 928 | value = parse_value(cs); |
| 929 | if (!value) |
| 930 | return -1; |
| 931 | } |
| 932 | /* |
| 933 | * We already consumed the \n, but we need linenr to point to |
| 934 | * the line we just parsed during the call to fn to get |
| 935 | * accurate line number in error messages. |
| 936 | */ |
| 937 | cs->linenr--; |
| 938 | kvi->linenr = cs->linenr; |
| 939 | ret = fn(name->buf, value, &ctx, data); |
| 940 | if (ret >= 0) |
| 941 | cs->linenr++; |
| 942 | return ret; |
| 943 | } |
| 944 | |
| 945 | static int get_extended_base_var(struct config_source *cs, struct strbuf *name, |
| 946 | int c) |
no test coverage detected