summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2014-02-22 16:02:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-25 17:51:24 (GMT)
commit3ee8944fa508675caad9b045af89bc5d845952f3 (patch)
tree83a30438fa130c7bb1b7fa05db654cf34dbca505
parent352bbbd9f24b39ae863ceb78170a2685d40e6416 (diff)
downloadgit-3ee8944fa508675caad9b045af89bc5d845952f3.zip
git-3ee8944fa508675caad9b045af89bc5d845952f3.tar.gz
git-3ee8944fa508675caad9b045af89bc5d845952f3.tar.bz2
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>
-rw-r--r--builtin/blame.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index ec1955d..1c692d8 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -923,7 +923,6 @@ static void find_copy_in_blob(struct scoreboard *sb,
mmfile_t *file_p)
{
const char *cp;
- int cnt;
mmfile_t file_o;
struct handle_split_cb_data d;
@@ -934,13 +933,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
*/
cp = nth_line(sb, ent->lno);
file_o.ptr = (char *) cp;
- cnt = ent->num_lines;
-
- while (cnt && cp < sb->final_buf + sb->final_buf_size) {
- if (*cp++ == '\n')
- cnt--;
- }
- file_o.size = cp - file_o.ptr;
+ file_o.size = nth_line(sb, ent->lno + ent->num_lines) - cp;
/*
* file_o is a part of final image we are annotating.