aboutsummaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-08-05 22:38:44 +0200
committerJunio C Hamano <gitster@pobox.com>2016-08-05 15:10:05 -0700
commit542aa25d9748c381a27074fb08614d4cb4713984 (patch)
tree2ab5cc63bf15d1eceb26ffd7c52924091b0b6e6a /builtin/worktree.c
parentc6b0597e9ac7277e148e2fd4d7615ac6e0bfb661 (diff)
downloadgit-542aa25d9748c381a27074fb08614d4cb4713984.tar.gz
git-542aa25d9748c381a27074fb08614d4cb4713984.tar.xz
use CHILD_PROCESS_INIT to initialize automatic variables
Initialize struct child_process variables already when they're defined. That's shorter and saves a function call. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 5a41788ed..6dcf7bd9d 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -194,7 +194,7 @@ static int add_worktree(const char *path, const char *refname,
struct strbuf sb = STRBUF_INIT;
const char *name;
struct stat st;
- struct child_process cp;
+ struct child_process cp = CHILD_PROCESS_INIT;
struct argv_array child_env = ARGV_ARRAY_INIT;
int counter = 0, len, ret;
struct strbuf symref = STRBUF_INIT;
@@ -273,7 +273,6 @@ static int add_worktree(const char *path, const char *refname,
argv_array_pushf(&child_env, "%s=%s", GIT_DIR_ENVIRONMENT, sb_git.buf);
argv_array_pushf(&child_env, "%s=%s", GIT_WORK_TREE_ENVIRONMENT, path);
- memset(&cp, 0, sizeof(cp));
cp.git_cmd = 1;
if (commit)
@@ -365,8 +364,7 @@ static int add(int ac, const char **av, const char *prefix)
}
if (opts.new_branch) {
- struct child_process cp;
- memset(&cp, 0, sizeof(cp));
+ struct child_process cp = CHILD_PROCESS_INIT;
cp.git_cmd = 1;
argv_array_push(&cp.args, "branch");
if (opts.force_new_branch)