config API: use get_error_routine(), not vreportf()

Change the git_die_config() function added in 5a80e97c827 (config: add `git_die_config()` to the config-set API, 2014-08-07) to use the public callbacks in the usage.[ch] API instead of the the underlying vreportf() function. In preceding commits the rest of the vreportf() users outside of usage.c was migrated to die_message(), so we can now make it "static". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Dec 7, 2021 at 19:26 UTC f5c39c3268107e1f3def70709d509fd24282832c
3 files changed +3 -3
config.c
+2 -1
@@ -2555,11 +2555,12 @@ void git_die_config(const char *key, const char *err, ...)
2555 {
2556 const struct string_list *values;
2557 struct key_value_info *kv_info;
2558 + report_fn error_fn = get_error_routine();
2559
2560 if (err) {
2561 va_list params;
2562 va_start(params, err);
2562 - vreportf("error: ", err, params);
2563 + error_fn(err, params);
2564 va_end(params);
2565 }
2566 values = git_config_get_value_multi(key);
git-compat-util.h
-1
@@ -474,7 +474,6 @@ static inline int git_has_dir_sep(const char *path)
474 struct strbuf;
475
476 /* General helper functions */
477 -void vreportf(const char *prefix, const char *err, va_list params);
477 NORETURN void usage(const char *err);
478 NORETURN void usagef(const char *err, ...) __attribute__((format (printf, 1, 2)));
479 NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
usage.c
+1 -1
@@ -6,7 +6,7 @@
6 #include "git-compat-util.h"
7 #include "cache.h"
8
9 -void vreportf(const char *prefix, const char *err, va_list params)
9 +static void vreportf(const char *prefix, const char *err, va_list params)
10 {
11 char msg[4096];
12 char *p, *pend = msg + sizeof(msg);