diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2019-11-12 11:38:16 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-12-06 13:29:04 -0800 |
commit | dd090a8a37b4507bf6c79ad93ec076673fa6313c (patch) | |
tree | c891dace87c11249e9a1235a6d0c4ab7f136f6e0 /builtin/log.c | |
parent | name-rev: extract creating/updating a 'struct name_rev' into a helper (diff) | |
download | tgif-dd090a8a37b4507bf6c79ad93ec076673fa6313c.tar.xz |
name-rev: pull out deref handling from the recursion
The 'if (deref) { ... }' condition near the beginning of the recursive
name_rev() function can only ever be true in the first invocation,
because the 'deref' parameter is always 0 in the subsequent recursive
invocations.
Extract this condition from the recursion into name_rev()'s caller and
drop the function's 'deref' parameter. This makes eliminating the
recursion a bit easier to follow, and it will be moved back into
name_rev() after the recursion is eliminated.
Furthermore, drop the condition that die()s when both 'deref' and
'generation' are non-null (which should have been a BUG() to begin
with).
Note that this change reintroduces the memory leak that was plugged in
in commit 5308224633 (name-rev: avoid leaking memory in the `deref`
case, 2017-05-04), but a later patch (name-rev: restructure
creating/updating 'struct rev_name' instances) in this series will
plug it in again.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
0 files changed, 0 insertions, 0 deletions