mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 13:05:35 +00:00
Trim fat from git_blame struct
This commit is contained in:
parent
a121e58011
commit
ef03d040cf
11
src/blame.c
11
src/blame.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user