summaryrefslogtreecommitdiffstats
path: root/contrib/persistent-https
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2026-02-15 04:02:23 -0500
committerJunio C Hamano <gitster@pobox.com>2026-02-17 09:45:29 -0800
commit87cb6dc9b0832683a31d0c3126ecad4ad444489c (patch)
treecfa609f251ac0cf159f15deca7aae992aad9c440 /contrib/persistent-https
parent5ec4c22e49839c2eeb319070cde14ddbea3d1adb (diff)
downloadgit-87cb6dc9b0832683a31d0c3126ecad4ad444489c.tar.gz
git-87cb6dc9b0832683a31d0c3126ecad4ad444489c.zip
ref-filter: simplify lstrip_ref_components() memory handling
We're walking forward in the string, skipping path components from left-to-right. So when we've stripped as much as we want, the pointer we have is a complete NUL-terminated string and we can just return it (after duplicating it, of course). So there is no need for a temporary allocated string. But we do make an extra temporary copy due to f0062d3b74 (ref-filter: free item->value and item->value->s, 2018-10-18). This is probably from cargo-culting the technique used in rstrip_ref_components(), which _does_ need a separate string (since it is stripping from the end and ties off the temporary string with a NUL). Let's drop the extra allocation. This is slightly more efficient, but more importantly makes the code much simpler. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions