blame: move entry prepend to libgit
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff Smith committed
May 24, 2017 at 00:15 UTC
bd481de713cb59a57f5f988b9bc46550c954dc45
3 files changed
+18
-14
blame.c
+16
@@ -1845,3 +1845,19 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
1845
if (orig)
1846
*orig = o;
1847
}
1848
+
1849
+
1850
+
1851
+struct blame_entry *blame_entry_prepend(struct blame_entry *head,
1852
+ long start, long end,
1853
+ struct blame_origin *o)
1854
+{
1855
+ struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
1856
+ new_head->lno = start;
1857
+ new_head->num_lines = end - start;
1858
+ new_head->suspect = o;
1859
+ new_head->s_lno = start;
1860
+ new_head->next = head;
1861
+ blame_origin_incref(o);
1862
+ return new_head;
1863
+}
blame.h
+2
@@ -170,4 +170,6 @@ extern const char *blame_nth_line(struct blame_scoreboard *sb, long lno);
170
extern void init_scoreboard(struct blame_scoreboard *sb);
171
extern void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blame_origin **orig);
172
173
+extern struct blame_entry *blame_entry_prepend(struct blame_entry *head, long start, long end, struct blame_origin *o);
174
+
175
#endif /* BLAME_H */
builtin/blame.c
-14
@@ -648,20 +648,6 @@ static int blame_move_callback(const struct option *option, const char *arg, int
648
return 0;
649
}
650
651
-struct blame_entry *blame_entry_prepend(struct blame_entry *head,
652
- long start, long end,
653
- struct blame_origin *o)
654
-{
655
- struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
656
- new_head->lno = start;
657
- new_head->num_lines = end - start;
658
- new_head->suspect = o;
659
- new_head->s_lno = start;
660
- new_head->next = head;
661
- blame_origin_incref(o);
662
- return new_head;
663
-}
664
-
651
int cmd_blame(int argc, const char **argv, const char *prefix)
652
{
653
struct rev_info revs;