]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config API: use get_error_routine(), not vreportf()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 7 Dec 2021 18:26:34 +0000 (19:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Dec 2021 21:25:16 +0000 (13:25 -0800)
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>
config.c
git-compat-util.h
usage.c

index c5873f3a70643a9c03feeec4981a06a439e78118..e96b8fdb62d9c5cec3b3e42ead16d69c09c14154 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2555,11 +2555,12 @@ void git_die_config(const char *key, const char *err, ...)
 {
        const struct string_list *values;
        struct key_value_info *kv_info;
+       report_fn error_fn = get_error_routine();
 
        if (err) {
                va_list params;
                va_start(params, err);
-               vreportf("error: ", err, params);
+               error_fn(err, params);
                va_end(params);
        }
        values = git_config_get_value_multi(key);
index c6c6f7d6b51d9ff4f4bada247bf3b7e06809ec91..bdb3977b9ecaa2c39b82b054366adb2ccd7f67ba 100644 (file)
@@ -474,7 +474,6 @@ static inline int git_has_dir_sep(const char *path)
 struct strbuf;
 
 /* General helper functions */
-void vreportf(const char *prefix, const char *err, va_list params);
 NORETURN void usage(const char *err);
 NORETURN void usagef(const char *err, ...) __attribute__((format (printf, 1, 2)));
 NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
diff --git a/usage.c b/usage.c
index 3d09e8eea48abedd61cec4ed7ff93d12b079b74a..9943dd8742e8adb2d283be453d7cb9da478a0a7e 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -6,7 +6,7 @@
 #include "git-compat-util.h"
 #include "cache.h"
 
-void vreportf(const char *prefix, const char *err, va_list params)
+static void vreportf(const char *prefix, const char *err, va_list params)
 {
        char msg[4096];
        char *p, *pend = msg + sizeof(msg);