1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-20 00:09:36 +02:00

usage: add get_error_routine() and get_warn_routine()

Let's make it possible to get the current error_routine and warn_routine,
so that we can store them before using set_error_routine() or
set_warn_routine() to use new ones.

This way we will be able put back the original routines, when we are done
with using new ones.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder 2016-09-04 22:18:28 +02:00 committed by Junio C Hamano
parent b83f108b08
commit 725149beab
2 changed files with 12 additions and 0 deletions

View File

@ -440,7 +440,9 @@ static inline int const_error(void)
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
extern void set_error_routine(void (*routine)(const char *err, va_list params));
extern void (*get_error_routine(void))(const char *err, va_list params);
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
extern void (*get_warn_routine(void))(const char *warn, va_list params);
extern void set_die_is_recursing_routine(int (*routine)(void));
extern void set_error_handle(FILE *);

10
usage.c
View File

@ -70,11 +70,21 @@ void set_error_routine(void (*routine)(const char *err, va_list params))
error_routine = routine;
}
void (*get_error_routine(void))(const char *err, va_list params)
{
return error_routine;
}
void set_warn_routine(void (*routine)(const char *warn, va_list params))
{
warn_routine = routine;
}
void (*get_warn_routine(void))(const char *warn, va_list params)
{
return warn_routine;
}
void set_die_is_recursing_routine(int (*routine)(void))
{
die_is_recursing = routine;