commit: move clear_commit_marks_many() loop body to clear_commit_marks()
clear_commit_marks_many() clears multiple commits one by one. Move the code for handling a single commit to clear_commit_marks() and call it instead of the other way around, to simplify the code. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Mar 23, 2025 at 10:53 UTC
98b423bc1c8a0ff93004deb56571553847276103
1 file changed
+7
-9
commit.c
+7
-9
@@ -780,19 +780,17 @@ static void clear_commit_marks_1(struct commit_list **plist,
780
781
void clear_commit_marks_many(size_t nr, struct commit **commit, unsigned int mark)
782
{
783
- for (size_t i = 0; i < nr; i++) {
784
- struct commit_list *list = NULL;
785
-
786
- clear_commit_marks_1(&list, *commit, mark);
787
- while (list)
788
- clear_commit_marks_1(&list, pop_commit(&list), mark);
789
- commit++;
790
- }
783
+ for (size_t i = 0; i < nr; i++)
784
+ clear_commit_marks(commit[i], mark);
785
}
786
787
void clear_commit_marks(struct commit *commit, unsigned int mark)
788
{
795
- clear_commit_marks_many(1, &commit, mark);
789
+ struct commit_list *list = NULL;
790
+
791
+ clear_commit_marks_1(&list, commit, mark);
792
+ while (list)
793
+ clear_commit_marks_1(&list, pop_commit(&list), mark);
794
}
795
796
struct commit *pop_commit(struct commit_list **stack)