From: Junio C Hamano Date: Sat, 21 Oct 2006 01:48:18 +0000 (-0700) Subject: git-pickaxe: fix nth_line() X-Git-Tag: v1.4.4-rc1~2^2~23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1ca6ca876e3553d9609823a70d168c50d7beba7e;p=git.git git-pickaxe: fix nth_line() We would want to be able to refer to the end of the file as "the beginning of Nth line" for a file that is N lines long. Signed-off-by: Junio C Hamano --- diff --git a/builtin-pickaxe.c b/builtin-pickaxe.c index 74c7c9a33..b595299bf 100644 --- a/builtin-pickaxe.c +++ b/builtin-pickaxe.c @@ -1085,6 +1085,9 @@ static int prepare_lines(struct scoreboard *sb) bol = 1; } } + sb->lineno = xrealloc(sb->lineno, + sizeof(int* ) * (num + incomplete + 1)); + sb->lineno[num + incomplete] = buf - sb->final_buf; sb->num_lines = num + incomplete; return sb->num_lines; }