summaryrefslogtreecommitdiff
path: root/diffcore-rotate.c
diff options
context:
space:
mode:
authorshejialuo <shejialuo@gmail.com>2024-11-20 19:51:24 +0800
committerJunio C Hamano <gitster@pobox.com>2024-11-21 08:21:32 +0900
commit56ca6039576294b6efb95345dafe81733bfb61d5 (patch)
treed977760323b5a13c23624cc1cf455a474ff9fd28 /diffcore-rotate.c
parent32dc1c7ec3c4e92704f221abbfee5cc1d50bf473 (diff)
ref: initialize ref name outside of check functions
We passes "refs_check_dir" to the "files_fsck_refs_name" function which allows it to create the checked ref name later. However, when we introduce a new check function, we have to allocate redundant memory and re-calculate the ref name. It's bad for us to allocate redundant memory and duplicate logic. Instead, we should allocate and calculate it only once and pass the ref name to the check functions. In order not to do repeat calculation, rename "refs_check_dir" to "refname". And in "files_fsck_refs_dir", create a new strbuf "refname", thus whenever we handle a new ref, calculate the name and call the check functions one by one. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rotate.c')
0 files changed, 0 insertions, 0 deletions