From: René Scharfe Date: Mon, 25 Dec 2017 17:43:37 +0000 (+0100) Subject: commit: avoid allocation in clear_commit_marks_many() X-Git-Tag: v2.16.2~7^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07f7d55a346f0eb73a358736ce065f8c08b46452;p=thirdparty%2Fgit.git commit: avoid allocation in clear_commit_marks_many() 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 Signed-off-by: Junio C Hamano --- diff --git a/commit.c b/commit.c index cab8d4455b..82667514bd 100644 --- a/commit.c +++ b/commit.c @@ -547,7 +547,7 @@ 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)