Blame SOURCES/diffutils-3.3-diffseq.patch

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