[PATCH v2 1/9] commit: avoid allocation in clear_commit_marks_many()
- From
René Scharfe <l.s.r@web.de>
- Date
- Dec 25, 2017, 17:43 UTC
- Message-ID
- <d37d0e0d-c703-a70c-cf0b-969e54473557@web.de>
- In-Reply-To
- <ac4c77a1-6403-ca20-2021-50c99201915a@web.de>
Pass the entries of the commit array directly to clear_commit_marks_1() instead of adding them to a commit_list first. The function clears the commit and any first parent without allocation; only higher numbered parents are added to a list for later treatment. This change extends that optimization to clear_commit_marks_many().
Signed-off-by: Rene Scharfe <l.s.r@web.de> --- commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c index cab8d4455b..82667514bd 100644 --- a/commit.c +++ b/commit.c @@ -545,11 +545,11 @@ static void clear_commit_marks_1(struct commit_list **plist, void clear_commit_marks_many(int nr, struct commit **commit, unsigned int mark) { struct commit_list *list = NULL; while (nr--) { - commit_list_insert(*commit, &list); + clear_commit_marks_1(&list, *commit, mark); commit++; } while (list) clear_commit_marks_1(&list, pop_commit(&list), mark); }
-- 2.15.1