Skip to content

Commit b226293

Browse files
rscharfegitster
authored andcommitted
trailer: use CHILD_PROCESS_INIT in apply_command()
Initialize the struct child_process variable cp at declaration time. This is shorter, saves a function call and prevents using the variable before initialization by mistake. Suggested-by: Jeff King <[email protected]> Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 66edfe9 commit b226293

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

trailer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static const char *apply_command(const char *command, const char *arg)
228228
{
229229
struct strbuf cmd = STRBUF_INIT;
230230
struct strbuf buf = STRBUF_INIT;
231-
struct child_process cp;
231+
struct child_process cp = CHILD_PROCESS_INIT;
232232
const char *argv[] = {NULL, NULL};
233233
const char *result;
234234

@@ -237,7 +237,6 @@ static const char *apply_command(const char *command, const char *arg)
237237
strbuf_replace(&cmd, TRAILER_ARG_STRING, arg);
238238

239239
argv[0] = cmd.buf;
240-
child_process_init(&cp);
241240
cp.argv = argv;
242241
cp.env = local_repo_env;
243242
cp.no_stdin = 1;

0 commit comments

Comments
 (0)