use child_process_init() to initialize struct child_process variables

Call child_process_init() instead of zeroing the memory of variables of type struct child_process by hand before use because the former is both clearer and shorter. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Oct 28, 2014 at 21:52 UTC 8828f2985f1967201c256fb01f92a91acfdb5001
4 files changed +4 -4
bundle.c
+1 -1
@@ -381,7 +381,7 @@ int create_bundle(struct bundle_header *header, const char *path,
381 write_or_die(bundle_fd, "\n", 1);
382
383 /* write pack */
384 - memset(&rls, 0, sizeof(rls));
384 + child_process_init(&rls);
385 argv_array_pushl(&rls.args,
386 "pack-objects", "--all-progress-implied",
387 "--stdout", "--thin", "--delta-base-offset",
column.c
+1 -1
@@ -374,7 +374,7 @@ int run_column_filter(int colopts, const struct column_options *opts)
374 if (fd_out != -1)
375 return -1;
376
377 - memset(&column_process, 0, sizeof(column_process));
377 + child_process_init(&column_process);
378 argv = &column_process.args;
379
380 argv_array_push(argv, "column");
trailer.c
+1 -1
@@ -237,7 +237,7 @@ 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 - memset(&cp, 0, sizeof(cp));
240 + child_process_init(&cp);
241 cp.argv = argv;
242 cp.env = local_repo_env;
243 cp.no_stdin = 1;
transport-helper.c
+1 -1
@@ -414,7 +414,7 @@ static int get_exporter(struct transport *transport,
414 struct child_process *helper = get_helper(transport);
415 int i;
416
417 - memset(fastexport, 0, sizeof(*fastexport));
417 + child_process_init(fastexport);
418
419 /* we need to duplicate helper->in because we want to use it after
420 * fastexport is done with it. */