Skip to content

Commit 16b2e57

Browse files
committed
Merge branch 'rs/clear-commit-marks-optim'
A micro-optimization. * rs/clear-commit-marks-optim: commit: avoid parent list buildup in clear_commit_marks_many()
2 parents c51a0b4 + 1ca727f commit 16b2e57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

commit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,14 +780,14 @@ static void clear_commit_marks_1(struct commit_list **plist,
780780

781781
void clear_commit_marks_many(size_t nr, struct commit **commit, unsigned int mark)
782782
{
783-
struct commit_list *list = NULL;
784-
785783
for (size_t i = 0; i < nr; i++) {
784+
struct commit_list *list = NULL;
785+
786786
clear_commit_marks_1(&list, *commit, mark);
787+
while (list)
788+
clear_commit_marks_1(&list, pop_commit(&list), mark);
787789
commit++;
788790
}
789-
while (list)
790-
clear_commit_marks_1(&list, pop_commit(&list), mark);
791791
}
792792

793793
void clear_commit_marks(struct commit *commit, unsigned int mark)

0 commit comments

Comments
 (0)