* All source specific fields in the union, die_on_error, name and the callbacks * fgetc, ungetc, ftell of top need to be initialized before calling * this function. */
| 1353 | * this function. |
| 1354 | */ |
| 1355 | static int do_config_from(struct config_source *top, config_fn_t fn, |
| 1356 | void *data, enum config_scope scope, |
| 1357 | const struct config_options *opts) |
| 1358 | { |
| 1359 | struct key_value_info kvi = KVI_INIT; |
| 1360 | int ret; |
| 1361 | |
| 1362 | /* push config-file parsing state stack */ |
| 1363 | top->linenr = 1; |
| 1364 | top->eof = 0; |
| 1365 | top->total_len = 0; |
| 1366 | strbuf_init(&top->value, 1024); |
| 1367 | strbuf_init(&top->var, 1024); |
| 1368 | kvi_from_source(top, scope, &kvi); |
| 1369 | |
| 1370 | ret = git_parse_source(top, fn, &kvi, data, opts); |
| 1371 | |
| 1372 | strbuf_release(&top->value); |
| 1373 | strbuf_release(&top->var); |
| 1374 | |
| 1375 | return ret; |
| 1376 | } |
| 1377 | |
| 1378 | static int do_config_from_file(config_fn_t fn, |
| 1379 | const enum config_origin_type origin_type, |
no test coverage detected