Skip to content

Commit 8828f29

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fbecd99 commit 8828f29

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ int create_bundle(struct bundle_header *header, const char *path,
381381
write_or_die(bundle_fd, "\n", 1);
382382

383383
/* write pack */
384-
memset(&rls, 0, sizeof(rls));
384+
child_process_init(&rls);
385385
argv_array_pushl(&rls.args,
386386
"pack-objects", "--all-progress-implied",
387387
"--stdout", "--thin", "--delta-base-offset",

column.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ int run_column_filter(int colopts, const struct column_options *opts)
374374
if (fd_out != -1)
375375
return -1;
376376

377-
memset(&column_process, 0, sizeof(column_process));
377+
child_process_init(&column_process);
378378
argv = &column_process.args;
379379

380380
argv_array_push(argv, "column");

trailer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ 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-
memset(&cp, 0, sizeof(cp));
240+
child_process_init(&cp);
241241
cp.argv = argv;
242242
cp.env = local_repo_env;
243243
cp.no_stdin = 1;

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static int get_exporter(struct transport *transport,
414414
struct child_process *helper = get_helper(transport);
415415
int i;
416416

417-
memset(fastexport, 0, sizeof(*fastexport));
417+
child_process_init(fastexport);
418418

419419
/* we need to duplicate helper->in because we want to use it after
420420
* fastexport is done with it. */

0 commit comments

Comments
 (0)