Commit ef03d040cf6cc81d71d340cf3915735724a77449

Ben Straub 2013-09-20T15:38:15

Trim fat from git_blame struct

diff --git a/src/blame.c b/src/blame.c
index 3b9d3db..e3460ba 100644
--- a/src/blame.c
+++ b/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);
diff --git a/src/blame.h b/src/blame.h
index 260d5b5..1b10732 100644
--- a/src/blame.h
+++ b/src/blame.h
@@ -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
diff --git a/tests-clar/blame/getters.c b/tests-clar/blame/getters.c
index 82e0de5..8d67e3e 100644
--- a/tests-clar/blame/getters.c
+++ b/tests-clar/blame/getters.c
@@ -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;