usage.c: drop set_error_handle()

The set_error_handle() function was introduced by 3b331e926 (vreportf: report to arbitrary filehandles, 2015-08-11) so that run-command could send post-fork, pre-exec errors to the parent's original stderr. That use went away in 79319b194 (run-command: eliminate calls to error handling functions in child, 2017-04-19), which pushes all of the error reporting to the parent. This leaves no callers of set_error_handle(). As we're not likely to add any new ones, let's drop it. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Brandon Williams <bmwill@google.com> Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 12, 2017 at 23:48 UTC e3f43ce765c38f4be94239d07c8c3c596780c514
2 files changed +1 -10
git-compat-util.h
-1
@@ -445,7 +445,6 @@ extern void (*get_error_routine(void))(const char *err, va_list params);
445 extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
446 extern void (*get_warn_routine(void))(const char *warn, va_list params);
447 extern void set_die_is_recursing_routine(int (*routine)(void));
448 -extern void set_error_handle(FILE *);
448
449 extern int starts_with(const char *str, const char *prefix);
450
usage.c
+1 -9
@@ -6,12 +6,9 @@
6 #include "git-compat-util.h"
7 #include "cache.h"
8
9 -static FILE *error_handle;
10 -
9 void vreportf(const char *prefix, const char *err, va_list params)
10 {
11 char msg[4096];
14 - FILE *fh = error_handle ? error_handle : stderr;
12 char *p;
13
14 vsnprintf(msg, sizeof(msg), err, params);
@@ -19,7 +16,7 @@ void vreportf(const char *prefix, const char *err, va_list params)
16 if (iscntrl(*p) && *p != '\t' && *p != '\n')
17 *p = '?';
18 }
22 - fprintf(fh, "%s%s\n", prefix, msg);
19 + fprintf(stderr, "%s%s\n", prefix, msg);
20 }
21
22 static NORETURN void usage_builtin(const char *err, va_list params)
@@ -88,11 +85,6 @@ void set_die_is_recursing_routine(int (*routine)(void))
85 die_is_recursing = routine;
86 }
87
91 -void set_error_handle(FILE *fh)
92 -{
93 - error_handle = fh;
94 -}
95 -
88 void NORETURN usagef(const char *err, ...)
89 {
90 va_list params;