Blame SOURCES/diffutils-3.3-diffseq.patch

727d13
diff -up diffutils-3.3/lib/diffseq.h.me diffutils-3.3/lib/diffseq.h
727d13
--- diffutils-3.3/lib/diffseq.h.me	2018-08-10 14:26:48.940444056 +0200
727d13
+++ diffutils-3.3/lib/diffseq.h	2018-08-10 14:26:50.453439777 +0200
727d13
@@ -138,12 +132,6 @@ struct partition
727d13
   /* Midpoints of this partition.  */
727d13
   OFFSET xmid;
727d13
   OFFSET ymid;
727d13
-
727d13
-  /* True if low half will be analyzed minimally.  */
727d13
-  bool lo_minimal;
727d13
-
727d13
-  /* Likewise for high half.  */
727d13
-  bool hi_minimal;
727d13
 };
727d13
 
727d13
 
727d13
@@ -175,7 +156,7 @@ struct partition
727d13
    suboptimal diff output.  It cannot cause incorrect diff output.  */
727d13
 
727d13
 static void
727d13
-diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
727d13
+diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
727d13
       struct partition *part, struct context *ctxt)
727d13
 {
727d13
   OFFSET *const fd = ctxt->fdiag;       /* Give the compiler a chance. */
727d13
@@ -235,7 +216,6 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y
727d13
             {
727d13
               part->xmid = x;
727d13
               part->ymid = y;
727d13
-              part->lo_minimal = part->hi_minimal = true;
727d13
               return;
727d13
             }
727d13
         }
727d13
@@ -268,14 +248,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y
727d13
             {
727d13
               part->xmid = x;
727d13
               part->ymid = y;
727d13
-              part->lo_minimal = part->hi_minimal = true;
727d13
               return;
727d13
             }
727d13
         }
727d13
 
727d13
-      if (find_minimal)
727d13
-        continue;
727d13
-
727d13
 #ifdef USE_HEURISTIC
727d13
       /* Heuristic: check occasionally for a diagonal that has made lots
727d13
          of progress compared with the edit distance.  If we have any
727d13
@@ -319,11 +295,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y
727d13
                   }
727d13
               }
727d13
             if (best > 0)
727d13
-              {
727d13
-                part->lo_minimal = true;
727d13
-                part->hi_minimal = false;
727d13
-                return;
727d13
-              }
727d13
+	      return;
727d13
           }
727d13
 
727d13
           {
727d13
@@ -358,77 +330,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y
727d13
                   }
727d13
               }
727d13
             if (best > 0)
727d13
-              {
727d13
-                part->lo_minimal = false;
727d13
-                part->hi_minimal = true;
727d13
-                return;
727d13
-              }
727d13
+	      return;
727d13
           }
727d13
         }
727d13
 #endif /* USE_HEURISTIC */
727d13
-
727d13
-      /* Heuristic: if we've gone well beyond the call of duty, give up
727d13
-         and report halfway between our best results so far.  */
727d13
-      if (c >= ctxt->too_expensive)
727d13
-        {
727d13
-          OFFSET fxybest;
727d13
-          OFFSET fxbest IF_LINT (= 0);
727d13
-          OFFSET bxybest;
727d13
-          OFFSET bxbest IF_LINT (= 0);
727d13
-
727d13
-          /* Find forward diagonal that maximizes X + Y.  */
727d13
-          fxybest = -1;
727d13
-          for (d = fmax; d >= fmin; d -= 2)
727d13
-            {
727d13
-              OFFSET x = MIN (fd[d], xlim);
727d13
-              OFFSET y = x - d;
727d13
-              if (ylim < y)
727d13
-                {
727d13
-                  x = ylim + d;
727d13
-                  y = ylim;
727d13
-                }
727d13
-              if (fxybest < x + y)
727d13
-                {
727d13
-                  fxybest = x + y;
727d13
-                  fxbest = x;
727d13
-                }
727d13
-            }
727d13
-
727d13
-          /* Find backward diagonal that minimizes X + Y.  */
727d13
-          bxybest = OFFSET_MAX;
727d13
-          for (d = bmax; d >= bmin; d -= 2)
727d13
-            {
727d13
-              OFFSET x = MAX (xoff, bd[d]);
727d13
-              OFFSET y = x - d;
727d13
-              if (y < yoff)
727d13
-                {
727d13
-                  x = yoff + d;
727d13
-                  y = yoff;
727d13
-                }
727d13
-              if (x + y < bxybest)
727d13
-                {
727d13
-                  bxybest = x + y;
727d13
-                  bxbest = x;
727d13
-                }
727d13
-            }
727d13
-
727d13
-          /* Use the better of the two diagonals.  */
727d13
-          if ((xlim + ylim) - bxybest < fxybest - (xoff + yoff))
727d13
-            {
727d13
-              part->xmid = fxbest;
727d13
-              part->ymid = fxybest - fxbest;
727d13
-              part->lo_minimal = true;
727d13
-              part->hi_minimal = false;
727d13
-            }
727d13
-          else
727d13
-            {
727d13
-              part->xmid = bxbest;
727d13
-              part->ymid = bxybest - bxbest;
727d13
-              part->lo_minimal = false;
727d13
-              part->hi_minimal = true;
727d13
-            }
727d13
-          return;
727d13
-        }
727d13
     }
727d13
   #undef XREF_YREF_EQUAL
727d13
 }
727d13
@@ -452,7 +354,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y
727d13
 
727d13
 static bool
727d13
 compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
727d13
-            bool find_minimal, struct context *ctxt)
727d13
+            struct context *ctxt)
727d13
 {
727d13
 #ifdef ELEMENT
727d13
   ELEMENT const *xv = ctxt->xvec; /* Help the compiler.  */
727d13
@@ -498,12 +400,12 @@ compareseq (OFFSET xoff, OFFSET xlim, OF
727d13
       struct partition part IF_LINT2 (= { .xmid = 0, .ymid = 0 });
727d13
 
727d13
       /* Find a point of correspondence in the middle of the vectors.  */
727d13
-      diag (xoff, xlim, yoff, ylim, find_minimal, &part, ctxt);
727d13
+      diag (xoff, xlim, yoff, ylim, &part, ctxt);
727d13
 
727d13
       /* Use the partitions to split this problem into subproblems.  */
727d13
-      if (compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal, ctxt))
727d13
+      if (compareseq (xoff, part.xmid, yoff, part.ymid, ctxt))
727d13
         return true;
727d13
-      if (compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal, ctxt))
727d13
+      if (compareseq (part.xmid, xlim, part.ymid, ylim, ctxt))
727d13
         return true;
727d13
     }
727d13
 
727d13
diff -up diffutils-3.3/src/analyze.c.me diffutils-3.3/src/analyze.c
727d13
--- diffutils-3.3/src/analyze.c.me	2018-08-10 14:06:53.473858743 +0200
727d13
+++ diffutils-3.3/src/analyze.c	2018-08-10 14:08:30.533579865 +0200
727d13
@@ -542,7 +542,6 @@ diff_2_files (struct comparison *cmp)
727d13
     {
727d13
       struct context ctxt;
727d13
       lin diags;
727d13
-      lin too_expensive;
727d13
 
727d13
       /* Allocate vectors for the results of comparison:
727d13
 	 a flag for each line of each file, saying whether that line
727d13
@@ -574,18 +573,11 @@ diff_2_files (struct comparison *cmp)
727d13
 
727d13
       ctxt.heuristic = speed_large_files;
727d13
 
727d13
-      /* Set TOO_EXPENSIVE to be approximate square root of input size,
727d13
-	 bounded below by 256.  */
727d13
-      too_expensive = 1;
727d13
-      for (;  diags != 0;  diags >>= 2)
727d13
-	too_expensive <<= 1;
727d13
-      ctxt.too_expensive = MAX (256, too_expensive);
727d13
-
727d13
       files[0] = cmp->file[0];
727d13
       files[1] = cmp->file[1];
727d13
 
727d13
       compareseq (0, cmp->file[0].nondiscarded_lines,
727d13
-		  0, cmp->file[1].nondiscarded_lines, minimal, &ctxt);
727d13
+		  0, cmp->file[1].nondiscarded_lines, &ctxt);
727d13
 
727d13
       free (ctxt.fdiag - (cmp->file[1].nondiscarded_lines + 1));
727d13
 
727d13
diff -up diffutils-3.3/src/diff.h.me diffutils-3.3/src/diff.h
727d13
--- diffutils-3.3/src/diff.h.me	2018-08-10 14:28:25.878169926 +0200
727d13
+++ diffutils-3.3/src/diff.h	2018-08-10 14:28:40.739127903 +0200
727d13
@@ -376,7 +376,7 @@ extern void print_sdiff_script (struct c
727d13
 extern char const change_letter[4];
727d13
 extern char const pr_program[];
727d13
 extern char *concat (char const *, char const *, char const *);
727d13
-extern bool (*lines_differ) (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
727d13
+extern bool (*lines_differ) (char const *, size_t, char const *, size_t);
727d13
 extern bool lines_differ_singlebyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
727d13
 #ifdef HANDLE_MULTIBYTE
727d13
 extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;