Skip to content

Commit

Permalink
try_merge_strategy(): remove redundant lock_file allocation
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 1, 2014
1 parent 2091c50 commit 1fef4b5
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,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));
struct commit_list *reversed = NULL;
struct merge_options o;
struct commit_list *j;
Expand Down

0 comments on commit 1fef4b5

Please sign in to comment.