@matheusbsbs / matheus-bagliano / commits / 1ca6ca876e
Fork 0

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 <junkio@cox.net>

Junio C Hamano committed Oct 20, 2006 at 18:48 UTC 1ca6ca876e3553d9609823a70d168c50d7beba7e
1 file changed +3
builtin-pickaxe.c
+3
@@ -1085,6 +1085,9 @@ static int prepare_lines(struct scoreboard *sb)
1085 bol = 1;
1086 }
1087 }
1088 + sb->lineno = xrealloc(sb->lineno,
1089 + sizeof(int* ) * (num + incomplete + 1));
1090 + sb->lineno[num + incomplete] = buf - sb->final_buf;
1091 sb->num_lines = num + incomplete;
1092 return sb->num_lines;
1093 }