Commit 9e86ef5
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 <[email protected]>
Mentored-by: Karthik Nayak <[email protected]>
Signed-off-by: shejialuo <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent bca954e commit 9e86ef5
1 file changed
+13
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3501 | 3501 | | |
3502 | 3502 | | |
3503 | 3503 | | |
3504 | | - | |
| 3504 | + | |
3505 | 3505 | | |
3506 | 3506 | | |
3507 | 3507 | | |
3508 | 3508 | | |
3509 | | - | |
| 3509 | + | |
3510 | 3510 | | |
3511 | 3511 | | |
3512 | 3512 | | |
| |||
3522 | 3522 | | |
3523 | 3523 | | |
3524 | 3524 | | |
3525 | | - | |
3526 | | - | |
| 3525 | + | |
3527 | 3526 | | |
3528 | 3527 | | |
3529 | | - | |
| 3528 | + | |
3530 | 3529 | | |
3531 | 3530 | | |
3532 | 3531 | | |
| |||
3542 | 3541 | | |
3543 | 3542 | | |
3544 | 3543 | | |
| 3544 | + | |
3545 | 3545 | | |
3546 | 3546 | | |
3547 | 3547 | | |
| |||
3560 | 3560 | | |
3561 | 3561 | | |
3562 | 3562 | | |
| 3563 | + | |
| 3564 | + | |
| 3565 | + | |
| 3566 | + | |
3563 | 3567 | | |
3564 | | - | |
3565 | | - | |
| 3568 | + | |
| 3569 | + | |
3566 | 3570 | | |
3567 | | - | |
| 3571 | + | |
3568 | 3572 | | |
3569 | 3573 | | |
3570 | 3574 | | |
| |||
3581 | 3585 | | |
3582 | 3586 | | |
3583 | 3587 | | |
| 3588 | + | |
3584 | 3589 | | |
3585 | 3590 | | |
3586 | 3591 | | |
| |||
0 commit comments