diff options
author | Russell Belfer <rb@github.com> | 2012-08-30 16:39:05 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-09-05 15:17:24 -0700 |
commit | 510f1bac6b94ce19459498ae78f87fc4f4552305 (patch) | |
tree | 77793e2bf6c22eacb2c5194ea0b78ba145371b0f /src/diff_output.c | |
parent | f335ecd6e126aa9dea28786522c0e6ce71596e91 (diff) | |
download | libgit2-510f1bac6b94ce19459498ae78f87fc4f4552305.tar.gz |
Fix comments and a minor bug
This adds better header comments and also fixes a bug in one of
simple APIs that tells the number of lines in the current hunk.
Diffstat (limited to 'src/diff_output.c')
-rw-r--r-- | src/diff_output.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/diff_output.c b/src/diff_output.c index 69921741c..d715f9ef4 100644 --- a/src/diff_output.c +++ b/src/diff_output.c @@ -1023,7 +1023,6 @@ struct git_diff_iterator { diffiter_hunk *hunk_curr; char hunk_header[128]; git_pool lines; - size_t line_count; diffiter_line *line_curr; }; @@ -1096,7 +1095,6 @@ static int diffiter_line_cb( line->len = content_len; info->last_hunk->line_count++; - iter->line_count++; if (info->last_hunk->line_head == NULL) info->last_hunk->line_head = line; @@ -1136,7 +1134,6 @@ static void diffiter_do_unload_file(git_diff_iterator *iter) iter->ctxt.delta = NULL; iter->hunk_head = NULL; iter->hunk_count = 0; - iter->line_count = 0; } int git_diff_iterator_new( @@ -1202,7 +1199,9 @@ int git_diff_iterator_num_hunks_in_file(git_diff_iterator *iter) int git_diff_iterator_num_lines_in_hunk(git_diff_iterator *iter) { int error = diffiter_do_diff_file(iter); - return (error != 0) ? error : (int)iter->line_count; + if (!error && iter->hunk_curr) + error = iter->hunk_curr->line_count; + return error; } int git_diff_iterator_next_file( |