git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2014, 17:51 UTC
Message-ID
<xmqq61o36pxq.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1393084967-23408-1-git-send-email-dak@gnu.org>
David Kastrup <dak@gnu.org> writes:
Show 6 quoted lines
> The region end can be looked up just like its beginning.
>
> Signed-off-by: David Kastrup <dak@gnu.org>
> ---
>  builtin/blame.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
Yay, code reduction!  Thanks.
Show 27 quoted lines
> 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.
Previous: David Kastrup
Message 2 of 2 in “builtin/blame.c::find_copy_in_blob: no need to scan for region end”
  1. builtin/blame.c::find_copy_in_blob: no need to scan for region endDavid Kastrup, Feb 22, 2014
  2. Junio C HamanoFeb 25, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.