# [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for line end

2 messages from 2014-02-22 to 2014-02-22. Participants: David Kastrup.
Thread: https://gitlist.dev/t/35935

## David Kastrup, 2014-02-22 15:49

Subject: [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for line end
Message-ID: <1393084157-23137-1-git-send-email-dak@gnu.org>
URL: https://gitlist.dev/e/1393084157-23137-1-git-send-email-dak%40gnu.org

```
---
 builtin/blame.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index e44a6bb..96716dd 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -939,7 +939,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;
 
@@ -950,13 +949,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.
-- 
1.8.3.2

```

## David Kastrup, 2014-02-22 15:52

Subject: Re: [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for line end
Message-ID: <874n3rf8kr.fsf@fencepost.gnu.org>
URL: https://gitlist.dev/e/874n3rf8kr.fsf%40fencepost.gnu.org
In-Reply-To: <1393084157-23137-1-git-send-email-dak@gnu.org>

```
David Kastrup <dak@gnu.org> writes:

Oh, good grief.  Forgot to sign off, and on rereading, the commit
message is clearly subfabulous.  So forget this one.  The content is
fine, though.

-- 
David Kastrup

```
