зеркало из https://github.com/microsoft/git.git
config API: use get_error_routine(), not vreportf()
Change the git_die_config() function added in 5a80e97c82
(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>
This commit is contained in:
Родитель
24f6e6d626
Коммит
f5c39c3268
3
config.c
3
config.c
|
@ -2555,11 +2555,12 @@ void git_die_config(const char *key, const char *err, ...)
|
||||||
{
|
{
|
||||||
const struct string_list *values;
|
const struct string_list *values;
|
||||||
struct key_value_info *kv_info;
|
struct key_value_info *kv_info;
|
||||||
|
report_fn error_fn = get_error_routine();
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
va_list params;
|
va_list params;
|
||||||
va_start(params, err);
|
va_start(params, err);
|
||||||
vreportf("error: ", err, params);
|
error_fn(err, params);
|
||||||
va_end(params);
|
va_end(params);
|
||||||
}
|
}
|
||||||
values = git_config_get_value_multi(key);
|
values = git_config_get_value_multi(key);
|
||||||
|
|
|
@ -474,7 +474,6 @@ static inline int git_has_dir_sep(const char *path)
|
||||||
struct strbuf;
|
struct strbuf;
|
||||||
|
|
||||||
/* General helper functions */
|
/* General helper functions */
|
||||||
void vreportf(const char *prefix, const char *err, va_list params);
|
|
||||||
NORETURN void usage(const char *err);
|
NORETURN void usage(const char *err);
|
||||||
NORETURN void usagef(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
NORETURN void usagef(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||||
NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||||
|
|
2
usage.c
2
usage.c
|
@ -6,7 +6,7 @@
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "cache.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 msg[4096];
|
||||||
char *p, *pend = msg + sizeof(msg);
|
char *p, *pend = msg + sizeof(msg);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче