Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/config.c b/config.c
index 850e432e30..662d406ac1 100644
--- a/config.c
+++ b/config.c
@@ -2317,6 +2317,7 @@ static void configset_iter(struct config_reader *reader, struct config_set *set,
struct string_list *values;
struct config_set_element *entry;
struct configset_list *list = &set->list;
+ struct config_context ctx = CONFIG_CONTEXT_INIT;
for (i = 0; i < list->nr; i++) {
entry = list->items[i].e;
@@ -2324,12 +2325,11 @@ static void configset_iter(struct config_reader *reader, struct config_set *set,
values = &entry->value_list;
config_reader_set_kvi(reader, values->items[value_index].util);
-
- if (fn(entry->key, values->items[value_index].string, NULL, data) < 0)
+ ctx.kvi = values->items[value_index].util;
+ if (fn(entry->key, values->items[value_index].string, &ctx, data) < 0)
git_die_config_linenr(entry->key,
- reader->config_kvi->filename,
- reader->config_kvi->linenr);
-
+ ctx.kvi->filename,
+ ctx.kvi->linenr);
config_reader_set_kvi(reader, NULL);
}
}
@@ -3984,13 +3984,8 @@ static int reader_origin_type(struct config_reader *reader,
return 0;
}
-const char *current_config_origin_type(void)
+const char *config_origin_type_name(enum config_origin_type type)
{
- enum config_origin_type type = CONFIG_ORIGIN_UNKNOWN;
-
- if (reader_origin_type(&the_reader, &type))
- BUG("current_config_origin_type called outside config callback");
-
switch (type) {
case CONFIG_ORIGIN_BLOB:
return "blob";
@@ -4007,6 +4002,16 @@ const char *current_config_origin_type(void)
}
}
+const char *current_config_origin_type(void)
+{
+ enum config_origin_type type = CONFIG_ORIGIN_UNKNOWN;
+
+ if (reader_origin_type(&the_reader, &type))
+ BUG("current_config_origin_type called outside config callback");
+
+ return config_origin_type_name(type);
+}
+
const char *config_scope_name(enum config_scope scope)
{
switch (scope) {
@@ -4054,14 +4059,6 @@ enum config_scope current_config_scope(void)
return the_reader.parsing_scope;
}
-int current_config_line(void)
-{
- if (the_reader.config_kvi)
- return the_reader.config_kvi->linenr;
- else
- return the_reader.source->linenr;
-}
-
int lookup_config(const char **mapping, int nr_mapping, const char *var)
{
int i;