@@ -2227,17 +2227,22 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)
struct configset_list *list = &cs->list;
for (i = 0; i < list->nr; i++) {
+ const char *key;
+ const char *val;
+ struct key_value_info *kvi;
+
entry = list->items[i].e;
value_index = list->items[i].value_index;
values = &entry->value_list;
- current_config_kvi = values->items[value_index].util;
-
- if (fn(entry->key, values->items[value_index].string, data) < 0)
- git_die_config_linenr(entry->key,
- current_config_kvi->filename,
- current_config_kvi->linenr);
+ key = entry->key;
+ val = values->items[value_index].string;
+ kvi = values->items[value_index].util;
+ current_config_kvi = kvi;
+ if (fn(key, val, data) < 0)
+ git_die_config_linenr(entry->key, kvi->filename,
+ kvi->linenr);
current_config_kvi = NULL;
}
}
Use variables rather than long lines in configset_iter(), and use our own "kvi" rather than relying on the global "current_config_kvi" within this function. There's no functional change here, but doing this will make a subsequent functional change smaller. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- config.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)