Skip to content

Commit 3ee8944

Browse files
dakhubgitgitster
authored andcommitted
builtin/blame.c::find_copy_in_blob: no need to scan for region end
The region end can be looked up just like its beginning. Signed-off-by: David Kastrup <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 352bbbd commit 3ee8944

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

builtin/blame.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,6 @@ static void find_copy_in_blob(struct scoreboard *sb,
923923
mmfile_t *file_p)
924924
{
925925
const char *cp;
926-
int cnt;
927926
mmfile_t file_o;
928927
struct handle_split_cb_data d;
929928

@@ -934,13 +933,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
934933
*/
935934
cp = nth_line(sb, ent->lno);
936935
file_o.ptr = (char *) cp;
937-
cnt = ent->num_lines;
938-
939-
while (cnt && cp < sb->final_buf + sb->final_buf_size) {
940-
if (*cp++ == '\n')
941-
cnt--;
942-
}
943-
file_o.size = cp - file_o.ptr;
936+
file_o.size = nth_line(sb, ent->lno + ent->num_lines) - cp;
944937

945938
/*
946939
* file_o is a part of final image we are annotating.

0 commit comments

Comments
 (0)