Merge branch 'so/rebase-doc-fork-point'
[gitweb.git] / line-log.c
index afcc98db930a36358283ff199a428b6c5bbbaf8f..038c58a395c6804e5f719d4d82a3d4edbd6d8901 100644 (file)
@@ -533,7 +533,7 @@ static void fill_line_ends(struct diff_filespec *spec, long *lines,
        }
 
        /* shrink the array to fit the elements */
-       ends = xrealloc(ends, cur * sizeof(*ends));
+       REALLOC_ARRAY(ends, cur);
        *lines = cur-1;
        *line_ends = ends;
 }
@@ -766,17 +766,6 @@ void line_log_init(struct rev_info *rev, const char *prefix, struct string_list
        }
 }
 
-static int count_parents(struct commit *commit)
-{
-       struct commit_list *parents = commit->parents;
-       int count = 0;
-       while (parents) {
-               count++;
-               parents = parents->next;
-       }
-       return count;
-}
-
 static void move_diff_queue(struct diff_queue_struct *dst,
                            struct diff_queue_struct *src)
 {
@@ -1150,7 +1139,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
        struct commit **parents;
        struct commit_list *p;
        int i;
-       int nparents = count_parents(commit);
+       int nparents = commit_list_count(commit->parents);
 
        diffqueues = xmalloc(nparents * sizeof(*diffqueues));
        cand = xmalloc(nparents * sizeof(*cand));