* [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for region end
@ 2014-02-22 16:02 David Kastrup
2014-02-25 17:51 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: David Kastrup @ 2014-02-22 16:02 UTC (permalink / raw)
To: git; +Cc: David Kastrup
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(-)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for region end
2014-02-22 16:02 [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for region end David Kastrup
@ 2014-02-25 17:51 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2014-02-25 17:51 UTC (permalink / raw)
To: David Kastrup; +Cc: git
David Kastrup <dak@gnu.org> writes:
> 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.
> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-25 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-22 16:02 [PATCH] builtin/blame.c::find_copy_in_blob: no need to scan for region end David Kastrup
2014-02-25 17:51 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.