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 --- builtin/replace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin/replace.c') diff --git a/builtin/replace.c b/builtin/replace.c index 294b61b97e..d2aac64260 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -197,7 +197,7 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f static void export_object(const unsigned char *sha1, enum object_type type, int raw, const char *filename) { - struct child_process cmd = { NULL }; + struct child_process cmd = CHILD_PROCESS_INIT; int fd; fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); @@ -234,7 +234,7 @@ static void import_object(unsigned char *sha1, enum object_type type, if (!raw && type == OBJ_TREE) { const char *argv[] = { "mktree", NULL }; - struct child_process cmd = { argv }; + struct child_process cmd = CHILD_PROCESS_INIT; struct strbuf result = STRBUF_INIT; cmd.argv = argv; -- cgit v1.2.3