Code

Merge branch 'rc/histogram-diff' into HEAD
authorJunio C Hamano <gitster@pobox.com>
Thu, 18 Aug 2011 00:17:16 +0000 (17:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Aug 2011 00:17:16 +0000 (17:17 -0700)
* rc/histogram-diff:
  xdiff/xhistogram: drop need for additional variable
  xdiff/xhistogram: rely on xdl_trim_ends()
  xdiff/xhistogram: rework handling of recursed results
  xdiff: do away with xdl_mmfile_next()
  Make test number unique
  xdiff/xprepare: use a smaller sample size for histogram diff
  xdiff/xprepare: skip classification
  teach --histogram to diff
  t4033-diff-patience: factor out tests
  xdiff/xpatience: factor out fall-back-diff function
  xdiff/xprepare: refactor abort cleanups
  xdiff/xprepare: use memset()

Conflicts:
xdiff/xprepare.c

1  2 
Makefile
diff.c
xdiff/xprepare.c

diff --cc Makefile
Simple merge
diff --cc diff.c
Simple merge
index 05a8f01f38a8391b74db0511e9ab0226d9448086,620fc9a657e2246d3a382c916c2cdd4f820c0c44..eba31ffaeebb4fe15f45ce854aa2ed3f63489b8c
@@@ -83,17 -80,8 +83,16 @@@ static int xdl_init_classifier(xdlclass
                xdl_cha_free(&cf->ncha);
                return -1;
        }
-       for (i = 0; i < cf->hsize; i++)
-               cf->rchash[i] = NULL;
+       memset(cf->rchash, 0, cf->hsize * sizeof(xdlclass_t *));
  
 +      cf->alloc = size;
 +      if (!(cf->rcrecs = (xdlclass_t **) xdl_malloc(cf->alloc * sizeof(xdlclass_t *)))) {
 +
 +              xdl_free(cf->rchash);
 +              xdl_cha_free(&cf->ncha);
 +              return -1;
 +      }
 +
        cf->count = 0;
  
        return 0;
@@@ -158,10 -132,10 +157,10 @@@ static int xdl_classify_record(unsigne
  }
  
  
 -static int xdl_prepare_ctx(mmfile_t *mf, long narec, xpparam_t const *xpp,
 +static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_t const *xpp,
                           xdlclassifier_t *cf, xdfile_t *xdf) {
        unsigned int hbits;
-       long i, nrec, hsize, bsize;
+       long nrec, hsize, bsize;
        unsigned long hav;
        char const *blk, *cur, *top, *prev;
        xrecord_t *crec;
                        crec->ha = hav;
                        recs[nrec++] = crec;
  
-                       if (xdl_classify_record(pass, cf, rhash, hbits, crec) < 0) {
-                               xdl_free(rhash);
-                               xdl_free(recs);
-                               xdl_cha_free(&xdf->rcha);
-                               return -1;
-                       }
+                       if (!(xpp->flags & XDF_HISTOGRAM_DIFF) &&
 -                              xdl_classify_record(cf, rhash, hbits, crec) < 0)
++                              xdl_classify_record(pass, cf, rhash, hbits, crec) < 0)
+                               goto abort;
                }
        }
  
@@@ -313,16 -269,18 +294,18 @@@ int xdl_prepare_env(mmfile_t *mf1, mmfi
                return -1;
        }
  
 -      if (!(xpp->flags & XDF_HISTOGRAM_DIFF))
 -              xdl_free_classifier(&cf);
 -
        if (!(xpp->flags & XDF_PATIENCE_DIFF) &&
 -                      xdl_optimize_ctxs(&xe->xdf1, &xe->xdf2) < 0) {
+                       !(xpp->flags & XDF_HISTOGRAM_DIFF) &&
 +                      xdl_optimize_ctxs(&cf, &xe->xdf1, &xe->xdf2) < 0) {
  
                xdl_free_ctx(&xe->xdf2);
                xdl_free_ctx(&xe->xdf1);
                return -1;
        }
  
-       xdl_free_classifier(&cf);
++      if (!(xpp->flags & XDF_HISTOGRAM_DIFF))
++              xdl_free_classifier(&cf);
 +
        return 0;
  }