Commit a121e580 by Ben Straub

Add typedefs for internal structs

parent 25c47aae
...@@ -221,7 +221,7 @@ static git_blame_hunk *split_hunk_in_vector( ...@@ -221,7 +221,7 @@ static git_blame_hunk *split_hunk_in_vector(
* To allow quick access to the contents of nth line in the * To allow quick access to the contents of nth line in the
* final image, prepare an index in the scoreboard. * final image, prepare an index in the scoreboard.
*/ */
static int prepare_lines(struct scoreboard *sb) static int prepare_lines(git_blame__scoreboard *sb)
{ {
const char *buf = sb->final_buf; const char *buf = sb->final_buf;
git_off_t len = sb->final_buf_size; git_off_t len = sb->final_buf_size;
...@@ -242,7 +242,7 @@ static int prepare_lines(struct scoreboard *sb) ...@@ -242,7 +242,7 @@ static int prepare_lines(struct scoreboard *sb)
return sb->num_lines; return sb->num_lines;
} }
static git_blame_hunk* hunk_from_entry(struct blame_entry *e) static git_blame_hunk* hunk_from_entry(git_blame__entry *e)
{ {
git_blame_hunk *h = new_hunk( git_blame_hunk *h = new_hunk(
e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path); e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path);
...@@ -255,10 +255,10 @@ static int walk_and_mark(git_blame *blame) ...@@ -255,10 +255,10 @@ static int walk_and_mark(git_blame *blame)
{ {
int error; int error;
struct scoreboard sb = {0}; git_blame__scoreboard sb = {0};
struct blame_entry *ent = NULL; git_blame__entry *ent = NULL;
git_blob *blob = NULL; git_blob *blob = NULL;
struct origin *o; git_blame__origin *o;
if ((error = git_commit_lookup(&sb.final, blame->repository, &blame->options.newest_commit)) < 0 || if ((error = git_commit_lookup(&sb.final, blame->repository, &blame->options.newest_commit)) < 0 ||
(error = git_object_lookup_bypath((git_object**)&blob, (git_object*)sb.final, blame->path, GIT_OBJ_BLOB)) < 0) (error = git_object_lookup_bypath((git_object**)&blob, (git_object*)sb.final, blame->path, GIT_OBJ_BLOB)) < 0)
...@@ -287,8 +287,8 @@ static int walk_and_mark(git_blame *blame) ...@@ -287,8 +287,8 @@ static int walk_and_mark(git_blame *blame)
cleanup: cleanup:
for (ent = sb.ent; ent; ) { for (ent = sb.ent; ent; ) {
struct blame_entry *e = ent->next; git_blame__entry *e = ent->next;
struct origin *o = ent->suspect; git_blame__origin *o = ent->suspect;
git_vector_insert(&blame->hunks, hunk_from_entry(ent)); git_vector_insert(&blame->hunks, hunk_from_entry(ent));
......
...@@ -9,22 +9,22 @@ ...@@ -9,22 +9,22 @@
/* /*
* One blob in a commit that is being suspected * One blob in a commit that is being suspected
*/ */
struct origin { typedef struct git_blame__origin {
int refcnt; int refcnt;
struct origin *previous; struct git_blame__origin *previous;
git_commit *commit; git_commit *commit;
git_blob *blob; git_blob *blob;
char path[]; char path[];
}; } git_blame__origin;
/* /*
* Each group of lines is described by a blame_entry; it can be split * Each group of lines is described by a git_blame__entry; it can be split
* as we pass blame to the parents. They form a linked list in the * as we pass blame to the parents. They form a linked list in the
* scoreboard structure, sorted by the target line number. * scoreboard structure, sorted by the target line number.
*/ */
struct blame_entry { typedef struct git_blame__entry {
struct blame_entry *prev; struct git_blame__entry *prev;
struct blame_entry *next; struct git_blame__entry *next;
/* the first line of this group in the final image; /* the first line of this group in the final image;
* internally all line numbers are 0 based. * internally all line numbers are 0 based.
...@@ -35,7 +35,7 @@ struct blame_entry { ...@@ -35,7 +35,7 @@ struct blame_entry {
int num_lines; int num_lines;
/* the commit that introduced this group into the final image */ /* the commit that introduced this group into the final image */
struct origin *suspect; git_blame__origin *suspect;
/* true if the suspect is truly guilty; false while we have not /* true if the suspect is truly guilty; false while we have not
* checked if the group came from one of its parents. * checked if the group came from one of its parents.
...@@ -59,12 +59,12 @@ struct blame_entry { ...@@ -59,12 +59,12 @@ struct blame_entry {
/* Whether this entry has been tracked to a boundary commit. /* Whether this entry has been tracked to a boundary commit.
*/ */
bool is_boundary; bool is_boundary;
}; } git_blame__entry;
/* /*
* The current state of the blame assignment. * The current state of the blame assignment.
*/ */
struct scoreboard { typedef struct git_blame__scoreboard {
/* the final commit (i.e. where we started digging from) */ /* the final commit (i.e. where we started digging from) */
git_commit *final; git_commit *final;
const char *path; const char *path;
...@@ -78,20 +78,20 @@ struct scoreboard { ...@@ -78,20 +78,20 @@ struct scoreboard {
git_off_t final_buf_size; git_off_t final_buf_size;
/* linked list of blames */ /* linked list of blames */
struct blame_entry *ent; git_blame__entry *ent;
/* look-up a line in the final buffer */ /* look-up a line in the final buffer */
int num_lines; int num_lines;
git_blame *blame; git_blame *blame;
}; } git_blame__scoreboard;
int get_origin(struct origin **out, struct scoreboard *sb, git_commit *commit, const char *path); int get_origin(git_blame__origin **out, git_blame__scoreboard *sb, git_commit *commit, const char *path);
int make_origin(struct origin **out, git_commit *commit, const char *path); int make_origin(git_blame__origin **out, git_commit *commit, const char *path);
struct origin *origin_incref(struct origin *o); git_blame__origin *origin_incref(git_blame__origin *o);
void origin_decref(struct origin *o); void origin_decref(git_blame__origin *o);
void assign_blame(struct scoreboard *sb, uint32_t flags); void assign_blame(git_blame__scoreboard *sb, uint32_t flags);
void coalesce(struct scoreboard *sb); void coalesce(git_blame__scoreboard *sb);
#endif #endif
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