Merge branch 'jm/maint-strncpy-diff-no-index'
[gitweb.git] / xdiff / xhistogram.c
index 130ceeed887099dbedf3f083209fe9d58b828353..bf99787c3e4c791426311495dda9d4da81cbb571 100644 (file)
@@ -252,7 +252,7 @@ static int fall_back_to_classic_diff(struct histindex *index,
                int line1, int count1, int line2, int count2)
 {
        xpparam_t xpp;
-       xpp.flags = index->xpp->flags & ~XDF_HISTOGRAM_DIFF;
+       xpp.flags = index->xpp->flags & ~XDF_DIFF_ALGORITHM_MASK;
 
        return xdl_fall_back_diff(index->env, &xpp,
                                  line1, count1, line2, count2);
@@ -323,11 +323,10 @@ static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
                result = fall_back_to_classic_diff(&index, line1, count1, line2, count2);
        else {
                if (lcs.begin1 == 0 && lcs.begin2 == 0) {
-                       int ptr;
-                       for (ptr = 0; ptr < count1; ptr++)
-                               env->xdf1.rchg[line1 + ptr - 1] = 1;
-                       for (ptr = 0; ptr < count2; ptr++)
-                               env->xdf2.rchg[line2 + ptr - 1] = 1;
+                       while (count1--)
+                               env->xdf1.rchg[line1++ - 1] = 1;
+                       while (count2--)
+                               env->xdf2.rchg[line2++ - 1] = 1;
                        result = 0;
                } else {
                        result = histogram_diff(xpp, env,