Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-10-05 23:32:03 +0300
committerJunio C Hamano <gitster@pobox.com>2017-10-06 04:07:10 +0300
commitf132a127eebb8f1b14b87fc317ca68278fceb2e8 (patch)
treee5da266e43348b450313a6679f790623436cffdc /merge.c
parentea220ee40cbb03a63ebad2be902057bf742492fd (diff)
sha1_file: do not leak `lock_file`
There is no longer any need to allocate and leak a `struct lock_file`. Initialize it on the stack instead. Before this patch, we set `lock = NULL` to signal that we have already rolled back, and that we should not do any more work. We need to take another approach now that we cannot assign NULL. We could, e.g., use `is_lock_file_locked()`. But we already have another variable that we could use instead, `found`. Its scope is only too small. Bump `found` to the scope of the whole function and rearrange the "roll back or write?"-checks to a straightforward if-else on `found`. This also future-proves the code by making it obvious that we intend to take exactly one of these paths. Improved-by: Jeff King <peff@peff.net> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge.c')
0 files changed, 0 insertions, 0 deletions