]> git.ipfire.org Git - thirdparty/git.git/commitdiff
usage.c: drop set_error_handle()
authorJeff King <peff@peff.net>
Sat, 13 May 2017 03:48:18 +0000 (23:48 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 May 2017 04:00:25 +0000 (13:00 +0900)
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>
git-compat-util.h
usage.c

index 8a4a3f85e7ba0a658420c477e1af82e804d7fd36..f1f2a2d73185361a1b68c8bffb6cafe5445b54cf 100644 (file)
@@ -445,7 +445,6 @@ 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 *);
 
 extern int starts_with(const char *str, const char *prefix);
 
diff --git a/usage.c b/usage.c
index ad6d2910fb58e2f27a52646bd79a0442e689517f..2623c078e1378819403ed1de52d2138226120ed6 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -6,12 +6,9 @@
 #include "git-compat-util.h"
 #include "cache.h"
 
-static FILE *error_handle;
-
 void vreportf(const char *prefix, const char *err, va_list params)
 {
        char msg[4096];
-       FILE *fh = error_handle ? error_handle : stderr;
        char *p;
 
        vsnprintf(msg, sizeof(msg), err, params);
@@ -19,7 +16,7 @@ void vreportf(const char *prefix, const char *err, va_list params)
                if (iscntrl(*p) && *p != '\t' && *p != '\n')
                        *p = '?';
        }
-       fprintf(fh, "%s%s\n", prefix, msg);
+       fprintf(stderr, "%s%s\n", prefix, msg);
 }
 
 static NORETURN void usage_builtin(const char *err, va_list params)
@@ -88,11 +85,6 @@ void set_die_is_recursing_routine(int (*routine)(void))
        die_is_recursing = routine;
 }
 
-void set_error_handle(FILE *fh)
-{
-       error_handle = fh;
-}
-
 void NORETURN usagef(const char *err, ...)
 {
        va_list params;