diff options
Diffstat (limited to 'line-log.c')
-rw-r--r-- | line-log.c | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -1,21 +1,22 @@ #include "git-compat-util.h" +#include "diffcore.h" #include "line-range.h" -#include "cache.h" +#include "hex.h" #include "tag.h" -#include "blob.h" #include "tree.h" #include "diff.h" #include "commit.h" #include "decorate.h" +#include "repository.h" #include "revision.h" #include "xdiff-interface.h" #include "strbuf.h" #include "log-tree.h" -#include "graph.h" -#include "userdiff.h" #include "line-log.h" +#include "setup.h" #include "strvec.h" #include "bloom.h" +#include "tree-walk.h" static void range_set_grow(struct range_set *rs, size_t extra) { @@ -296,7 +297,7 @@ static void line_log_data_insert(struct line_log_data **list, return; } - p = xcalloc(1, sizeof(struct line_log_data)); + CALLOC_ARRAY(p, 1); p->path = path; range_set_append(&p->ranges, begin, end); if (ip) { @@ -481,7 +482,7 @@ static struct commit *check_single_commit(struct rev_info *revs) if (obj->flags & UNINTERESTING) continue; obj = deref_tag(revs->repo, obj, NULL, 0); - if (obj->type != OBJ_COMMIT) + if (!obj || obj->type != OBJ_COMMIT) die("Non commit %s?", revs->pending.objects[i].name); if (commit) die("More than one commit to dig from: %s and %s?", @@ -1089,10 +1090,8 @@ static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair) static void free_diffqueues(int n, struct diff_queue_struct *dq) { - int i, j; - for (i = 0; i < n; i++) - for (j = 0; j < dq[i].nr; j++) - diff_free_filepair(dq[i].queue[j]); + for (int i = 0; i < n; i++) + diff_free_queue(&dq[i]); free(dq); } @@ -1159,7 +1158,7 @@ static int bloom_filter_check(struct rev_info *rev, return 1; if (!rev->bloom_filter_settings || - !(filter = get_bloom_filter(rev->repo, commit, 0))) + !(filter = get_bloom_filter(rev->repo, commit))) return 1; if (!range) @@ -1195,6 +1194,7 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c if (parent) add_line_range(rev, parent, parent_range); free_line_log_data(parent_range); + diff_free_queue(&queue); return changed; } @@ -1282,7 +1282,8 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit return changed; } -static enum rewrite_result line_log_rewrite_one(struct rev_info *rev, struct commit **pp) +static enum rewrite_result line_log_rewrite_one(struct rev_info *rev UNUSED, + struct commit **pp) { for (;;) { struct commit *p = *pp; @@ -1324,3 +1325,13 @@ int line_log_filter(struct rev_info *rev) return 0; } + +static void free_void_line_log_data(void *data) +{ + free_line_log_data(data); +} + +void line_log_free(struct rev_info *rev) +{ + clear_decoration(&rev->line_log_data, free_void_line_log_data); +} |