Avoid C99 initializers
[gitweb.git] / commit.c
index a608faf23217fadd42105d9eab96b28474930b69..c6bf10d045a45a38352af0a7dc0b3732b7493182 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -397,12 +397,14 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
 {
        struct commit_list *parents;
 
-       if (!commit)
-               return;
-       parents = commit->parents;
        commit->object.flags &= ~mark;
+       parents = commit->parents;
        while (parents) {
-               clear_commit_marks(parents->item, mark);
+               struct commit *parent = parents->item;
+
+               /* Have we already cleared this? */
+               if (mark & parent->object.flags)
+                       clear_commit_marks(parent, mark);
                parents = parents->next;
        }
 }
@@ -1058,7 +1060,7 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
        }
 
        if (!result)
-               return NULL;
+               goto finish;
 
        if (result->next && list)
                mark_reachable_commits(result, list);
@@ -1081,6 +1083,7 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
                tmp = next;
        }
 
+ finish:
        if (cleanup) {
                clear_commit_marks(rev1, PARENT1 | PARENT2 | STALE);
                clear_commit_marks(rev2, PARENT1 | PARENT2 | STALE);