git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Makarov <einmalfel@gmail.com>
To: git@vger.kernel.org
Cc: vmiklos@frugalware.org, Vasily Makarov <einmalfel@gmail.com>
Subject: [PATCH] get_octopus_merge_bases(): cleanup redundant variable
Date: Fri,  3 Jan 2014 18:45:46 +0400	[thread overview]
Message-ID: <1388760346-19515-1-git-send-email-einmalfel@gmail.com> (raw)

pptr is needless. Some related code got cleaned as well

Signed-off-by: Vasily Makarov <einmalfel@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

             reply	other threads:[~2014-01-03 14:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 14:45 Vasily Makarov [this message]
2014-01-03 18:26 ` [PATCH] get_octopus_merge_bases(): cleanup redundant variable Junio C Hamano
2014-01-03 19:01   ` Vasily Makarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1388760346-19515-1-git-send-email-einmalfel@gmail.com \
    --to=einmalfel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=vmiklos@frugalware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).