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>
Christian Couder committed
Sep 4, 2016 at 22:18 UTC
725149beab088b1368cc01aa3f1a7845db14132d
2 files changed
+12
git-compat-util.h
+2
@@ -440,7 +440,9 @@ static inline int const_error(void)
440
441
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
442
extern void set_error_routine(void (*routine)(const char *err, va_list params));
443
+extern void (*get_error_routine(void))(const char *err, va_list params);
444
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
445
+extern void (*get_warn_routine(void))(const char *warn, va_list params);
446
extern void set_die_is_recursing_routine(int (*routine)(void));
447
extern void set_error_handle(FILE *);
448
usage.c
+10
@@ -70,11 +70,21 @@ void set_error_routine(void (*routine)(const char *err, va_list params))
70
error_routine = routine;
71
}
72
73
+void (*get_error_routine(void))(const char *err, va_list params)
74
+{
75
+ return error_routine;
76
+}
77
+
78
void set_warn_routine(void (*routine)(const char *warn, va_list params))
79
{
80
warn_routine = routine;
81
}
82
83
+void (*get_warn_routine(void))(const char *warn, va_list params)
84
+{
85
+ return warn_routine;
86
+}
87
+
88
void set_die_is_recursing_routine(int (*routine)(void))
89
{
90
die_is_recursing = routine;