pptr is needless. Some related code got cleaned as well

Signed-off-by: Vasily Makarov <einmal...@gmail.com>
---
 commit.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/commit.c b/commit.c
index de16a3c..4a7a192 100644
--- a/commit.c
+++ b/commit.c
@@ -834,26 +834,23 @@ static struct commit_list *merge_bases_many(struct commit 
*one, int n, struct co
 struct commit_list *get_octopus_merge_bases(struct commit_list *in)
 {
        struct commit_list *i, *j, *k, *ret = NULL;
-       struct commit_list **pptr = &ret;
 
-       for (i = in; i; i = i->next) {
-               if (!ret)
-                       pptr = &commit_list_insert(i->item, pptr)->next;
-               else {
-                       struct commit_list *new = NULL, *end = NULL;
-
-                       for (j = ret; j; j = j->next) {
-                               struct commit_list *bases;
-                               bases = get_merge_bases(i->item, j->item, 1);
-                               if (!new)
-                                       new = bases;
-                               else
-                                       end->next = bases;
-                               for (k = bases; k; k = k->next)
-                                       end = k;
-                       }
-                       ret = new;
+       commit_list_insert(in->item, &ret);
+
+       for (i = in->next; i; i = i->next) {
+               struct commit_list *new = NULL, *end = NULL;
+
+               for (j = ret; j; j = j->next) {
+                       struct commit_list *bases;
+                       bases = get_merge_bases(i->item, j->item, 1);
+                       if (!new)
+                               new = bases;
+                       else
+                               end->next = bases;
+                       for (k = bases; k; k = k->next)
+                               end = k;
                }
+               ret = new;
        }
        return ret;
 }
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to