Skip to content

Commit 2820985

Browse files
stefanbellergitster
authored andcommitted
xdiff/xhistogram: pass arguments directly to fall_back_to_classic_diff
By passing the 'xpp' and 'env' argument directly to the function 'fall_back_to_classic_diff', we eliminate an occurrence of the 'index' in histogram_diff, which will prove useful in a bit. While at it, move it up in the file. This will make the diff of one of the next patches more legible. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 27dea46 commit 2820985

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

xdiff/xhistogram.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,
233233
return b_next;
234234
}
235235

236+
static int fall_back_to_classic_diff(xpparam_t const *xpp, xdfenv_t *env,
237+
int line1, int count1, int line2, int count2)
238+
{
239+
xpparam_t xpparam;
240+
xpparam.flags = xpp->flags & ~XDF_DIFF_ALGORITHM_MASK;
241+
242+
return xdl_fall_back_diff(env, &xpparam,
243+
line1, count1, line2, count2);
244+
}
245+
236246
static int find_lcs(struct histindex *index, struct region *lcs,
237247
int line1, int count1, int line2, int count2) {
238248
int b_ptr;
@@ -248,16 +258,6 @@ static int find_lcs(struct histindex *index, struct region *lcs,
248258
return index->has_common && index->max_chain_length < index->cnt;
249259
}
250260

251-
static int fall_back_to_classic_diff(struct histindex *index,
252-
int line1, int count1, int line2, int count2)
253-
{
254-
xpparam_t xpp;
255-
xpp.flags = index->xpp->flags & ~XDF_DIFF_ALGORITHM_MASK;
256-
257-
return xdl_fall_back_diff(index->env, &xpp,
258-
line1, count1, line2, count2);
259-
}
260-
261261
static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
262262
int line1, int count1, int line2, int count2)
263263
{
@@ -320,7 +320,7 @@ static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
320320

321321
memset(&lcs, 0, sizeof(lcs));
322322
if (find_lcs(&index, &lcs, line1, count1, line2, count2))
323-
result = fall_back_to_classic_diff(&index, line1, count1, line2, count2);
323+
result = fall_back_to_classic_diff(xpp, env, line1, count1, line2, count2);
324324
else {
325325
if (lcs.begin1 == 0 && lcs.begin2 == 0) {
326326
while (count1--)

0 commit comments

Comments
 (0)