summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2025-03-23 10:53:21 +0100
committerJunio C Hamano <gitster@pobox.com>2025-03-24 14:52:29 +0900
commit98b423bc1c8a0ff93004deb56571553847276103 (patch)
tree42d1cfbaec7bac8c9b39f215c109fbd053e1f41a /commit.c
parent683c54c999c301c2cd6f715c411407c413b1d84e (diff)
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/commit.c b/commit.c
index 6efdb03997..425503bb9f 100644
--- a/commit.c
+++ b/commit.c
@@ -780,19 +780,17 @@ static void clear_commit_marks_1(struct commit_list **plist,
void clear_commit_marks_many(size_t nr, struct commit **commit, unsigned int mark)
{
- for (size_t i = 0; i < nr; i++) {
- struct commit_list *list = NULL;
-
- clear_commit_marks_1(&list, *commit, mark);
- while (list)
- clear_commit_marks_1(&list, pop_commit(&list), mark);
- commit++;
- }
+ for (size_t i = 0; i < nr; i++)
+ clear_commit_marks(commit[i], mark);
}
void clear_commit_marks(struct commit *commit, unsigned int mark)
{
- clear_commit_marks_many(1, &commit, mark);
+ struct commit_list *list = NULL;
+
+ clear_commit_marks_1(&list, commit, mark);
+ while (list)
+ clear_commit_marks_1(&list, pop_commit(&list), mark);
}
struct commit *pop_commit(struct commit_list **stack)