[RFC/PATCH 05/18] commit: move reverse_commit_list() into commit.{h, c}
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
commit.c | 11 +++++++++++
commit.h | 2 ++
merge-recursive.c | 11 -----------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/commit.c b/commit.c
index 0094ec1..f9d5bf9 100644
--- a/commit.c
+++ b/commit.c
@@ -351,6 +351,17 @@ unsigned commit_list_count(const struct commit_list *l)
return c;
}
+struct commit_list *reverse_commit_list(struct commit_list *list)
+{
+ struct commit_list *next = NULL, *current, *backup;
+ for (current = list; current; current = backup) {
+ backup = current->next;
+ current->next = next;
+ next = current;
+ }
+ return next;
+}
+
void free_commit_list(struct commit_list *list)
{
while (list) {
diff --git a/commit.h b/commit.h
index 9113bbe..6a074a1 100644
--- a/commit.h
+++ b/commit.h
@@ -48,6 +48,8 @@ struct commit_list * commit_list_insert(struct commit *item, struct commit_list
unsigned commit_list_count(const struct commit_list *l);
struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
+struct commit_list *reverse_commit_list(struct commit_list *list);
+
void free_commit_list(struct commit_list *list);
void sort_by_date(struct commit_list **list);
diff --git a/merge-recursive.c b/merge-recursive.c
index 16c2dbe..d02fda6 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1573,17 +1573,6 @@ int merge_trees(struct merge_options *o,
return clean;
}
-static struct commit_list *reverse_commit_list(struct commit_list *list)
-{
- struct commit_list *next = NULL, *current, *backup;
- for (current = list; current; current = backup) {
- backup = current->next;
- current->next = next;
- next = current;
- }
- return next;
-}
-
/*
* Merge the commits h1 and h2, return the resulting virtual
* commit object and a flag indicating the cleanness of the merge.
--
1.7.3.2.504.g59d466