Mercurial > hg-stable
changeset 36834:e5b14f5b8b94
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
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 09 Mar 2018 14:52:36 -0800 |
parents | f1ef0e53e628 |
children | 12492794bf8c |
files | mercurial/thirdparty/xdiff/xdiffi.c |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/thirdparty/xdiff/xdiffi.c Fri Mar 09 14:47:29 2018 -0800 +++ b/mercurial/thirdparty/xdiff/xdiffi.c Fri Mar 09 14:52:36 2018 -0800 @@ -1015,8 +1015,6 @@ 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 @@ 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 @@ 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;