get_octopus_merge_bases(): cleanup redundant variable
pptr is needless. Some related code got cleaned as well. Signed-off-by: Vasily Makarov <einmalfel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vasily Makarov committed
Jan 3, 2014 at 18:45 UTC
6bc76725eaa2f4bb8c5fad47f843425d9160e7f3
1 file changed
+18
-18
commit.c
+18
-18
@@ -841,26 +841,26 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
841
struct commit_list *get_octopus_merge_bases(struct commit_list *in)
842
{
843
struct commit_list *i, *j, *k, *ret = NULL;
844
- struct commit_list **pptr = &ret;
844
846
- for (i = in; i; i = i->next) {
847
- if (!ret)
848
- pptr = &commit_list_insert(i->item, pptr)->next;
849
- else {
850
- struct commit_list *new = NULL, *end = NULL;
851
-
852
- for (j = ret; j; j = j->next) {
853
- struct commit_list *bases;
854
- bases = get_merge_bases(i->item, j->item, 1);
855
- if (!new)
856
- new = bases;
857
- else
858
- end->next = bases;
859
- for (k = bases; k; k = k->next)
860
- end = k;
861
- }
862
- ret = new;
845
+ if (!in)
846
+ return ret;
847
+
848
+ commit_list_insert(in->item, &ret);
849
+
850
+ for (i = in->next; i; i = i->next) {
851
+ struct commit_list *new = NULL, *end = NULL;
852
+
853
+ for (j = ret; j; j = j->next) {
854
+ struct commit_list *bases;
855
+ bases = get_merge_bases(i->item, j->item, 1);
856
+ if (!new)
857
+ new = bases;
858
+ else
859
+ end->next = bases;
860
+ for (k = bases; k; k = k->next)
861
+ end = k;
862
}
863
+ ret = new;
864
}
865
return ret;
866
}