quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Since the value won't be changed inside the code (because context lines
  feature was removed by https://phab.mercurial-scm.org/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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2766

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c

CHANGE DETAILS

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,16 +1015,14 @@
 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 */
        for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) {
                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;



To: quark, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to