Commit f89d085
log: refactor "rev.pending" code in cmd_show()
Refactor the juggling of "rev.pending" and our replacement for it
amended in the preceding commit so that:
* We use an "unsigned int" instead of an "int" for "i", this matches
the types of "struct rev_info" itself.
* We don't need the "count" and "objects" variables introduced in
5d7eeee (git-show: grok blobs, trees and tags, too, 2006-12-14).
They were originally added since we'd clobber rev.pending in the
loop without restoring it. Since the preceding commit we are
restoring it when we handle OBJ_COMMIT, so the main for-loop can
refer to "rev.pending" didrectly.
* We use the "memcpy a &blank" idiom introduced in
5726a6b (*.c *_init(): define in terms of corresponding *_INIT
macro, 2021-07-01).
This is more obvious than relying on us enumerating all of the
relevant members of the "struct object_array" that we need to
clear.
* We comment on why we don't need an object_array_clear() here, see
the analysis in [1].
1. https://lore.kernel.org/git/YuQtJ2DxNKX%[email protected]/
Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>
Helped-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 055e57b commit f89d085
1 file changed
+15
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
671 | | - | |
| 671 | + | |
672 | 672 | | |
673 | 673 | | |
674 | | - | |
| 674 | + | |
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
702 | | - | |
703 | 701 | | |
704 | | - | |
705 | | - | |
706 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
707 | 705 | | |
708 | 706 | | |
709 | 707 | | |
| |||
726 | 724 | | |
727 | 725 | | |
728 | 726 | | |
729 | | - | |
| 727 | + | |
730 | 728 | | |
731 | 729 | | |
732 | 730 | | |
| |||
745 | 743 | | |
746 | 744 | | |
747 | 745 | | |
| 746 | + | |
748 | 747 | | |
749 | 748 | | |
750 | | - | |
751 | | - | |
| 749 | + | |
| 750 | + | |
752 | 751 | | |
753 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
754 | 759 | | |
755 | 760 | | |
756 | 761 | | |
| |||
0 commit comments