[PATCH v3 19/25] try_merge_strategy(): remove redundant lock_file allocation
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Apr 14, 2014, 13:54 UTC
- Message-ID
- <1397483695-10888-20-git-send-email-mhagger@alum.mit.edu>
- In-Reply-To
- <1397483695-10888-1-git-send-email-mhagger@alum.mit.edu>
By the time the "if" block is entered, the lock_file instance from the main function block is no longer in use, so re-use that one instead of allocating a second one.
Note that the "lock" variable in the "if" block shadowed the "lock" variable at function scope, so the only change needed is to remove the inner definition.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> --- builtin/merge.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/builtin/merge.c b/builtin/merge.c index 66d8843..9b7e7cb 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -671,7 +671,6 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common, if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) { int clean, x; struct commit *result; - struct lock_file *lock = xcalloc(1, sizeof(struct lock_file)); int index_fd; struct commit_list *reversed = NULL; struct merge_options o;
-- 1.9.1