# HG changeset patch # User Jun Wu # Date 2018-03-09 22:52:36 # Node ID e5b14f5b8b94c33e54900289acde796dc2c9d74e # Parent f1ef0e53e628e67c64f879994ac343816471bf3c xdiff: resolve signed unsigned comparison warning Since the value won't be changed inside the code (because context lines feature was removed by D2705), let's just remove the variable and inline the 0 value. The code might be potentially further simplified. But I'd like to make sure correctness is easily verifiable in this patch. Differential Revision: https://phab.mercurial-scm.org/D2766 diff --git a/mercurial/thirdparty/xdiff/xdiffi.c b/mercurial/thirdparty/xdiff/xdiffi.c --- a/mercurial/thirdparty/xdiff/xdiffi.c +++ b/mercurial/thirdparty/xdiff/xdiffi.c @@ -1015,8 +1015,6 @@ void xdl_free_script(xdchange_t *xscr) { xdchange_t *xdl_get_hunk(xdchange_t **xscr) { xdchange_t *xch, *xchp, *lxch; - int64_t max_common = 0; - int64_t max_ignorable = 0; uint64_t ignored = 0; /* number of ignored blank lines */ /* remove ignorable changes that are too far before other changes */ @@ -1024,7 +1022,7 @@ xdchange_t *xdl_get_hunk(xdchange_t **xs xch = xchp->next; if (xch == NULL || - xch->i1 - (xchp->i1 + xchp->chg1) >= max_ignorable) + xch->i1 - (xchp->i1 + xchp->chg1) >= 0) *xscr = xch; } @@ -1035,16 +1033,16 @@ xdchange_t *xdl_get_hunk(xdchange_t **xs for (xchp = *xscr, xch = xchp->next; xch; xchp = xch, xch = xch->next) { int64_t distance = xch->i1 - (xchp->i1 + xchp->chg1); - if (distance > max_common) + if (distance > 0) break; - if (distance < max_ignorable && (!xch->ignore || lxch == xchp)) { + if (distance < 0 && (!xch->ignore || lxch == xchp)) { lxch = xch; ignored = 0; - } else if (distance < max_ignorable && xch->ignore) { + } else if (distance < 0 && xch->ignore) { ignored += xch->chg2; } else if (lxch != xchp && - xch->i1 + ignored - (lxch->i1 + lxch->chg1) > max_common) { + xch->i1 + ignored - (lxch->i1 + lxch->chg1) > 0) { break; } else if (!xch->ignore) { lxch = xch;