summaryrefslogtreecommitdiff
path: root/src/revwalk.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-12-02 04:58:22 +0200
committerVicent Marti <tanoku@gmail.com>2010-12-02 04:58:22 +0200
commiteec952351363354cad2e094a10d8545e4d2a996f (patch)
tree901189c584a5bbe12d0387ff6cb2de174d55f069 /src/revwalk.c
parent41109a7e7eb4544dc64c563d947f6655d45c1a28 (diff)
downloadlibgit2-eec952351363354cad2e094a10d8545e4d2a996f.tar.gz
Commit parents now use the common 'vector' code
No more linked lists, no more O(n) access. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/revwalk.c')
-rw-r--r--src/revwalk.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/revwalk.c b/src/revwalk.c
index eda45f04b..b724f77c8 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -123,7 +123,7 @@ static git_revwalk_commit *commit_to_walkcommit(git_revwalk *walk, git_commit *c
static git_revwalk_commit *insert_commit(git_revwalk *walk, git_commit *commit_object)
{
git_revwalk_commit *commit;
- git_commit_parents *parents;
+ unsigned int i;
assert(walk && commit_object);
@@ -139,13 +139,16 @@ static git_revwalk_commit *insert_commit(git_revwalk *walk, git_commit *commit_o
commit->seen = 1;
- for (parents = commit->commit_object->parents; parents != NULL; parents = parents->next) {
+ for (i = 0; i < commit->commit_object->parents.length; ++i) {
+ git_commit *parent_object;
git_revwalk_commit *parent;
- if ((parent = commit_to_walkcommit(walk, parents->commit)) == NULL)
+ parent_object = git_vector_get(&commit->commit_object->parents, i);
+
+ if ((parent = commit_to_walkcommit(walk, parent_object)) == NULL)
return NULL;
- parent = insert_commit(walk, parents->commit);
+ parent = insert_commit(walk, parent_object);
if (parent == NULL)
return NULL;