From d3180279322c7450a47decf8833de47f444ca93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 19 Aug 2014 21:09:35 +0200 Subject: run-command: introduce CHILD_PROCESS_INIT Most struct child_process variables are cleared using memset first after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's shorter, doesn't require a function call and is slightly more readable (especially given that we already have STRBUF_INIT, ARGV_ARRAY_INIT etc.). Helped-by: Johannes Sixt Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- convert.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'convert.c') diff --git a/convert.c b/convert.c index cb5fbb45ea..aa7a139bcf 100644 --- a/convert.c +++ b/convert.c @@ -321,7 +321,7 @@ static int filter_buffer(int in, int out, void *data) /* * Spawn cmd and feed the buffer contents through its stdin. */ - struct child_process child_process; + struct child_process child_process = CHILD_PROCESS_INIT; struct filter_params *params = (struct filter_params *)data; int write_err, status; const char *argv[] = { NULL, NULL }; @@ -344,7 +344,6 @@ static int filter_buffer(int in, int out, void *data) argv[0] = cmd.buf; - memset(&child_process, 0, sizeof(child_process)); child_process.argv = argv; child_process.use_shell = 1; child_process.in = -1; -- cgit v1.2.3