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 <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Nov 9, 2014 at 14:49 UTC
b226293b44750f4e2ebd121e6f85528170f8e2c5
1 file changed
+1
-2
trailer.c
+1
-2
@@ -228,7 +228,7 @@ static const char *apply_command(const char *command, const char *arg)
228
{
229
struct strbuf cmd = STRBUF_INIT;
230
struct strbuf buf = STRBUF_INIT;
231
- struct child_process cp;
231
+ struct child_process cp = CHILD_PROCESS_INIT;
232
const char *argv[] = {NULL, NULL};
233
const char *result;
234
@@ -237,7 +237,6 @@ static const char *apply_command(const char *command, const char *arg)
237
strbuf_replace(&cmd, TRAILER_ARG_STRING, arg);
238
239
argv[0] = cmd.buf;
240
- child_process_init(&cp);
240
cp.argv = argv;
241
cp.env = local_repo_env;
242
cp.no_stdin = 1;