8 struct diff_line_range
;
11 typedef const char *(*nth_line_fn_t
)(void *data
, long lno
);
14 int start
, end
; /* Line range of post-image */
15 int pstart
, pend
; /* Line range of pre-image */
16 int line_added
: 1; /* whether this range is added */
21 struct print_range
*ranges
;
24 #define PRINT_RANGE_INIT(r) \
26 (r)->start = (r)->end = 0; \
27 (r)->pstart = (r)->pend = 0; \
28 (r)->line_added = 0; \
31 #define PRINT_PAIR_INIT(p) \
33 (p)->alloc = (p)->nr = 0; \
37 #define PRINT_PAIR_GROW(p) \
40 ALLOC_GROW((p)->ranges, (p)->nr, (p)->alloc); \
43 #define PRINT_PAIR_CLEAR(p) \
45 (p)->alloc = (p)->nr = 0; \
52 const char *arg
; /* The argument to specify this line range */
53 long start
, end
; /* The interesting line range of current commit */
54 long pstart
, pend
; /* The corresponding range of parent commit */
55 struct print_pair pair
;
56 /* The changed lines inside this range */
60 struct diff_line_range
{
61 struct diff_filespec
*prev
;
62 struct diff_filespec
*spec
;
66 struct line_range
*ranges
;
69 struct diff_line_range
*next
;
72 #define RANGE_INIT(r) \
75 (r)->start = (r)->end = 0; \
76 (r)->pstart = (r)->pend = 0; \
77 PRINT_PAIR_INIT(&((r)->pair)); \
81 #define RANGE_CLEAR(r) \
84 (r)->start = (r)->end = 0; \
85 (r)->pstart = (r)->pend = 0; \
86 PRINT_PAIR_CLEAR(&r->pair); \
90 #define DIFF_LINE_RANGE_INIT(r) \
92 (r)->prev = (r)->spec = NULL; \
94 (r)->alloc = (r)->nr = 0; \
101 #define DIFF_LINE_RANGE_GROW(r) \
104 ALLOC_GROW((r)->ranges, (r)->nr, (r)->alloc); \
105 RANGE_INIT(((r)->ranges + (r)->nr - 1)); \
108 #define DIFF_LINE_RANGE_CLEAR(r) \
109 diff_line_range_clear((r));
111 extern struct line_range
*diff_line_range_insert(struct diff_line_range
*r
,
112 const char *arg
, int start
, int end
);
114 extern void diff_line_range_append(struct diff_line_range
*r
, const char *arg
);
116 extern void diff_line_range_clear(struct diff_line_range
*r
);
118 extern struct diff_line_range
*diff_line_range_merge(
119 struct diff_line_range
*out
,
120 struct diff_line_range
*other
);
122 extern struct diff_line_range
*diff_line_range_clone(struct diff_line_range
*r
);
124 extern struct diff_line_range
*diff_line_range_clone_deeply(struct diff_line_range
*r
);
126 extern void setup_line(struct rev_info
*rev
, struct diff_line_range
*r
);
128 extern void add_line_range(struct rev_info
*revs
, struct commit
*commit
,
129 struct diff_line_range
*r
);
131 extern struct diff_line_range
*lookup_line_range(struct rev_info
*revs
,
132 struct commit
*commit
);
134 const char *parse_loc(const char *spec
, nth_line_fn_t nth_line
,
135 void *data
, long lines
, long begin
, long *ret
);
137 extern int cmd_line_log_walk(struct rev_info
*rev
);
139 extern void limit_list_line(struct rev_info
*rev
);