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 <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Kastrup committed
Feb 22, 2014 at 17:02 UTC
3ee8944fa508675caad9b045af89bc5d845952f3
1 file changed
+1
-8
builtin/blame.c
+1
-8
@@ -923,7 +923,6 @@ static void find_copy_in_blob(struct scoreboard *sb,
923
mmfile_t *file_p)
924
{
925
const char *cp;
926
- int cnt;
926
mmfile_t file_o;
927
struct handle_split_cb_data d;
928
@@ -934,13 +933,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
933
*/
934
cp = nth_line(sb, ent->lno);
935
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;
937
938
/*
939
* file_o is a part of final image we are annotating.