Commit ef03d040 by Ben Straub

Trim fat from git_blame struct

parent a121e580
......@@ -62,11 +62,6 @@ static git_blame_hunk* new_hunk(uint16_t start, uint16_t lines, uint16_t orig_st
return hunk;
}
git_blame_hunk* git_blame__alloc_hunk()
{
return new_hunk(0,0,0,NULL);
}
static git_blame_hunk* dup_hunk(git_blame_hunk *hunk)
{
git_blame_hunk *newhunk = new_hunk(hunk->final_start_line_number, hunk->lines_in_hunk, hunk->orig_start_line_number, hunk->orig_path);
......@@ -106,13 +101,11 @@ git_blame* git_blame__alloc(
return NULL;
}
git_vector_init(&gbr->hunks, 8, hunk_sort_cmp_by_start_line);
git_vector_init(&gbr->unclaimed_hunks, 8, hunk_sort_cmp_by_start_line);
git_vector_init(&gbr->paths, 8, paths_cmp);
gbr->repository = repo;
gbr->options = opts;
gbr->path = git__strdup(path);
git_vector_insert(&gbr->paths, git__strdup(path));
gbr->final_blob = NULL;
return gbr;
}
......@@ -128,10 +121,6 @@ void git_blame_free(git_blame *blame)
free_hunk(hunk);
git_vector_free(&blame->hunks);
git_vector_foreach(&blame->unclaimed_hunks, i, hunk)
free_hunk(hunk);
git_vector_free(&blame->unclaimed_hunks);
git_vector_foreach(&blame->paths, i, path)
git__free(path);
git_vector_free(&blame->paths);
......
......@@ -14,16 +14,11 @@ struct git_blame {
git_blame_options options;
git_vector hunks;
git_vector unclaimed_hunks;
git_vector paths;
git_blob *final_blob;
size_t num_lines;
git_oid current_commit;
git_oid parent_commit;
size_t current_diff_line;
size_t current_blame_line;
git_blame_hunk *current_hunk;
};
......@@ -32,6 +27,4 @@ git_blame *git_blame__alloc(
git_blame_options opts,
const char *path);
git_blame_hunk *git_blame__alloc_hunk();
#endif
......@@ -20,7 +20,7 @@ void test_blame_getters__initialize(void)
g_blame = git_blame__alloc(NULL, opts, "");
for (i=0; i<5; i++) {
git_blame_hunk *h = git_blame__alloc_hunk();
git_blame_hunk *h = git__calloc(1, sizeof(git_blame_hunk));
h->final_start_line_number = hunks[i].final_start_line_number;
h->orig_path = git__strdup(hunks[i].orig_path);
h->lines_in_hunk = hunks[i].lines_in_hunk;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment