Message ID | patch-v2-13.13-289d5a2d849-20211015T093918Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | hook.[ch]: new library to run hooks + simple hook conversion | expand |
On Fri, Oct 15, 2021 at 11:43:41AM +0200, Ævar Arnfjörð Bjarmason wrote: > > > The new hook.h library has replaced all run-command.h hook-related > functionality. So let's delete this dead code. > > Signed-off-by: Emily Shaffer <emilyshaffer@google.com> > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Emily Shaffer <emilyshaffer@google.com> Thanks. > --- > run-command.c | 32 -------------------------------- > run-command.h | 16 ---------------- > 2 files changed, 48 deletions(-) > > diff --git a/run-command.c b/run-command.c > index d92e670c8ed..8a21ff525f3 100644 > --- a/run-command.c > +++ b/run-command.c > @@ -1323,38 +1323,6 @@ int async_with_fork(void) > #endif > } > > -static int run_hook_ve(const char *const *env, const char *name, va_list args) > -{ > - struct child_process hook = CHILD_PROCESS_INIT; > - const char *p; > - > - p = find_hook(name); > - if (!p) > - return 0; > - > - strvec_push(&hook.args, p); > - while ((p = va_arg(args, const char *))) > - strvec_push(&hook.args, p); > - hook.env = env; > - hook.no_stdin = 1; > - hook.stdout_to_stderr = 1; > - hook.trace2_hook_name = name; > - > - return run_command(&hook); > -} > - > -int run_hook_le(const char *const *env, const char *name, ...) > -{ > - va_list args; > - int ret; > - > - va_start(args, name); > - ret = run_hook_ve(env, name, args); > - va_end(args); > - > - return ret; > -} > - > struct io_pump { > /* initialized by caller */ > int fd; > diff --git a/run-command.h b/run-command.h > index 3fa7454cf8a..59e1fbff64c 100644 > --- a/run-command.h > +++ b/run-command.h > @@ -224,22 +224,6 @@ int finish_command_in_signal(struct child_process *); > */ > int run_command(struct child_process *); > > -/** > - * Run a hook. > - * The first argument is a pathname to an index file, or NULL > - * if the hook uses the default index file or no index is needed. > - * The second argument is the name of the hook. > - * The further arguments correspond to the hook arguments. > - * The last argument has to be NULL to terminate the arguments list. > - * If the hook does not exist or is not executable, the return > - * value will be zero. > - * If it is executable, the hook will be executed and the exit > - * status of the hook is returned. > - * On execution, .stdout_to_stderr and .no_stdin will be set. > - */ > -LAST_ARG_MUST_BE_NULL > -int run_hook_le(const char *const *env, const char *name, ...); > - > /* > * Trigger an auto-gc > */ > -- > 2.33.1.1338.g20da966911a >
diff --git a/run-command.c b/run-command.c index d92e670c8ed..8a21ff525f3 100644 --- a/run-command.c +++ b/run-command.c @@ -1323,38 +1323,6 @@ int async_with_fork(void) #endif } -static int run_hook_ve(const char *const *env, const char *name, va_list args) -{ - struct child_process hook = CHILD_PROCESS_INIT; - const char *p; - - p = find_hook(name); - if (!p) - return 0; - - strvec_push(&hook.args, p); - while ((p = va_arg(args, const char *))) - strvec_push(&hook.args, p); - hook.env = env; - hook.no_stdin = 1; - hook.stdout_to_stderr = 1; - hook.trace2_hook_name = name; - - return run_command(&hook); -} - -int run_hook_le(const char *const *env, const char *name, ...) -{ - va_list args; - int ret; - - va_start(args, name); - ret = run_hook_ve(env, name, args); - va_end(args); - - return ret; -} - struct io_pump { /* initialized by caller */ int fd; diff --git a/run-command.h b/run-command.h index 3fa7454cf8a..59e1fbff64c 100644 --- a/run-command.h +++ b/run-command.h @@ -224,22 +224,6 @@ int finish_command_in_signal(struct child_process *); */ int run_command(struct child_process *); -/** - * Run a hook. - * The first argument is a pathname to an index file, or NULL - * if the hook uses the default index file or no index is needed. - * The second argument is the name of the hook. - * The further arguments correspond to the hook arguments. - * The last argument has to be NULL to terminate the arguments list. - * If the hook does not exist or is not executable, the return - * value will be zero. - * If it is executable, the hook will be executed and the exit - * status of the hook is returned. - * On execution, .stdout_to_stderr and .no_stdin will be set. - */ -LAST_ARG_MUST_BE_NULL -int run_hook_le(const char *const *env, const char *name, ...); - /* * Trigger an auto-gc */