* [PATCH] usage.c: drop set_error_handle()
@ 2017-05-13 3:48 Jeff King
2017-05-13 13:32 ` Ramsay Jones
2017-05-14 2:12 ` Brandon Williams
0 siblings, 2 replies; 3+ messages in thread
From: Jeff King @ 2017-05-13 3:48 UTC (permalink / raw)
To: git; +Cc: Brandon Williams
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>
---
This goes on top of bw/forking-and-threading.
git-compat-util.h | 1 -
usage.c | 10 +---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 8a4a3f85e..f1f2a2d73 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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 ad6d2910f..2623c078e 100644
--- 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;
--
2.13.0.452.g0afc8e12b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usage.c: drop set_error_handle()
2017-05-13 3:48 [PATCH] usage.c: drop set_error_handle() Jeff King
@ 2017-05-13 13:32 ` Ramsay Jones
2017-05-14 2:12 ` Brandon Williams
1 sibling, 0 replies; 3+ messages in thread
From: Ramsay Jones @ 2017-05-13 13:32 UTC (permalink / raw)
To: Jeff King, git; +Cc: Brandon Williams
On 13/05/17 04:48, Jeff King wrote:
> 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>
I have an identical patch, which I had intended to send at
the 'start of the next cycle'. :D (Well, you actually had
a commit message ...).
So, FWIW: ACK
ATB,
Ramsay Jones
> ---
> This goes on top of bw/forking-and-threading.
>
> git-compat-util.h | 1 -
> usage.c | 10 +---------
> 2 files changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 8a4a3f85e..f1f2a2d73 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -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 ad6d2910f..2623c078e 100644
> --- 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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usage.c: drop set_error_handle()
2017-05-13 3:48 [PATCH] usage.c: drop set_error_handle() Jeff King
2017-05-13 13:32 ` Ramsay Jones
@ 2017-05-14 2:12 ` Brandon Williams
1 sibling, 0 replies; 3+ messages in thread
From: Brandon Williams @ 2017-05-14 2:12 UTC (permalink / raw)
To: Jeff King; +Cc: git
On 05/12, Jeff King wrote:
> 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>
Looks good to me!
Thanks
--
Brandon Williams
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-14 2:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-13 3:48 [PATCH] usage.c: drop set_error_handle() Jeff King
2017-05-13 13:32 ` Ramsay Jones
2017-05-14 2:12 ` Brandon Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).