@@ -93,18 +93,25 @@ static bool same_suspect(git_blame__origin *a, git_blame__origin *b)
93
93
}
94
94
95
95
/* find the line number of the last line the target is suspected for */
96
- static int find_last_in_target (git_blame * blame , git_blame__origin * target )
96
+ static bool find_last_in_target (size_t * out , git_blame * blame , git_blame__origin * target )
97
97
{
98
98
git_blame__entry * e ;
99
- int last_in_target = -1 ;
99
+ size_t last_in_target = 0 ;
100
+ bool found = false;
101
+
102
+ * out = 0 ;
100
103
101
104
for (e = blame -> ent ; e ; e = e -> next ) {
102
105
if (e -> guilty || !same_suspect (e -> suspect , target ))
103
106
continue ;
104
- if (last_in_target < e -> s_lno + e -> num_lines )
107
+ if (last_in_target < e -> s_lno + e -> num_lines ) {
108
+ found = true;
105
109
last_in_target = e -> s_lno + e -> num_lines ;
110
+ }
106
111
}
107
- return last_in_target ;
112
+
113
+ * out = last_in_target ;
114
+ return found ;
108
115
}
109
116
110
117
/*
@@ -122,9 +129,9 @@ static int find_last_in_target(git_blame *blame, git_blame__origin *target)
122
129
* to be blamed for the parent, and after that portion.
123
130
*/
124
131
static void split_overlap (git_blame__entry * split , git_blame__entry * e ,
125
- int tlno , int plno , int same , git_blame__origin * parent )
132
+ size_t tlno , size_t plno , size_t same , git_blame__origin * parent )
126
133
{
127
- int chunk_end_lno ;
134
+ size_t chunk_end_lno ;
128
135
129
136
if (e -> s_lno < tlno ) {
130
137
/* there is a pre-chunk part not blamed on the parent */
@@ -265,9 +272,9 @@ static void decref_split(git_blame__entry *split)
265
272
static void blame_overlap (
266
273
git_blame * blame ,
267
274
git_blame__entry * e ,
268
- int tlno ,
269
- int plno ,
270
- int same ,
275
+ size_t tlno ,
276
+ size_t plno ,
277
+ size_t same ,
271
278
git_blame__origin * parent )
272
279
{
273
280
git_blame__entry split [3 ] = {{0 }};
@@ -285,9 +292,9 @@ static void blame_overlap(
285
292
*/
286
293
static void blame_chunk (
287
294
git_blame * blame ,
288
- int tlno ,
289
- int plno ,
290
- int same ,
295
+ size_t tlno ,
296
+ size_t plno ,
297
+ size_t same ,
291
298
git_blame__origin * target ,
292
299
git_blame__origin * parent )
293
300
{
@@ -314,7 +321,7 @@ static int my_emit(
314
321
blame_chunk (d -> blame , d -> tlno , d -> plno , start_b , d -> target , d -> parent );
315
322
d -> plno = start_a + count_a ;
316
323
d -> tlno = start_b + count_b ;
317
-
324
+
318
325
return 0 ;
319
326
}
320
327
@@ -376,12 +383,11 @@ static int pass_blame_to_parent(
376
383
git_blame__origin * target ,
377
384
git_blame__origin * parent )
378
385
{
379
- int last_in_target ;
386
+ size_t last_in_target ;
380
387
mmfile_t file_p , file_o ;
381
388
blame_chunk_cb_data d = { blame , target , parent , 0 , 0 };
382
389
383
- last_in_target = find_last_in_target (blame , target );
384
- if (last_in_target < 0 )
390
+ if (!find_last_in_target (& last_in_target , blame , target ))
385
391
return 1 ; /* nothing remains for this target */
386
392
387
393
fill_origin_blob (parent , & file_p );
0 commit comments