49
} while(0)
50
51
static struct combine_diff_path *ll_diff_tree_paths(
52
- struct combine_diff_path *p, const struct object_id *oid,
52
+ struct combine_diff_path *tail, const struct object_id *oid,
53
const struct object_id **parents_oid, int nparent,
54
struct strbuf *base, struct diff_options *opt,
55
int depth);
134
* t, tp -> path modified/added
135
* (M for tp[i]=tp[imin], A otherwise)
136
*/
137
-static struct combine_diff_path *emit_path(struct combine_diff_path *p,
137
+static struct combine_diff_path *emit_path(struct combine_diff_path *tail,
138
struct strbuf *base, struct diff_options *opt, int nparent,
139
struct tree_desc *t, struct tree_desc *tp,
140
int imin, int depth)
177
178
if (emitthis) {
179
int keep;
180
- struct combine_diff_path *pprev = p;
180
+ struct combine_diff_path *pprev = tail, *p;
181
182
strbuf_add(base, path, pathlen);
183
p = combine_diff_path_new(base->buf, base->len, mode,
184
oid ? oid : null_oid(),
185
nparent);
186
- pprev->next = p;
186
+ tail->next = p;
187
+ tail = p;
188
strbuf_setlen(base, old_baselen);
189
190
for (i = 0; i < nparent; ++i) {
223
if (!keep) {
224
free(p);
225
pprev->next = NULL;
225
- p = pprev;
226
+ tail = pprev;
227
}
228
}
229
240
241
strbuf_add(base, path, pathlen);
242
strbuf_addch(base, '/');
242
- p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt,
243
- depth + 1);
243
+ tail = ll_diff_tree_paths(tail, oid, parents_oid, nparent, base, opt,
244
+ depth + 1);
245
FAST_ARRAY_FREE(parents_oid, nparent);
246
}
247
248
strbuf_setlen(base, old_baselen);
248
- return p;
249
+ return tail;
250
}
251
252
static void skip_uninteresting(struct tree_desc *t, struct strbuf *base,
360
}
361
362
static struct combine_diff_path *ll_diff_tree_paths(
362
- struct combine_diff_path *p, const struct object_id *oid,
363
+ struct combine_diff_path *tail, const struct object_id *oid,
364
const struct object_id **parents_oid, int nparent,
365
struct strbuf *base, struct diff_options *opt,
366
int depth)
464
}
465
466
/* D += {δ(t,pi) if pi=p[imin]; "+a" if pi > p[imin]} */
466
- p = emit_path(p, base, opt, nparent,
467
- &t, tp, imin, depth);
467
+ tail = emit_path(tail, base, opt, nparent,
468
+ &t, tp, imin, depth);
469
470
skip_emit_t_tp:
471
/* t↓, ∀ pi=p[imin] pi↓ */
476
/* t < p[imin] */
477
else if (cmp < 0) {
478
/* D += "+t" */
478
- p = emit_path(p, base, opt, nparent,
479
- &t, /*tp=*/NULL, -1, depth);
479
+ tail = emit_path(tail, base, opt, nparent,
480
+ &t, /*tp=*/NULL, -1, depth);
481
482
/* t↓ */
483
update_tree_entry(&t);
492
goto skip_emit_tp;
493
}
494
494
- p = emit_path(p, base, opt, nparent,
495
- /*t=*/NULL, tp, imin, depth);
495
+ tail = emit_path(tail, base, opt, nparent,
496
+ /*t=*/NULL, tp, imin, depth);
497
498
skip_emit_tp:
499
/* ∀ pi=p[imin] pi↓ */
507
FAST_ARRAY_FREE(tptree, nparent);
508
FAST_ARRAY_FREE(tp, nparent);
509
509
- return p;
510
+ return tail;
511
}
512
513
struct combine_diff_path *diff_tree_paths(