Code

Merge branch 'jc/utf8'
[git.git] / xdiff / xdiffi.c
index b95ade2c1b58a48a91bf9a87c7a3893559580225..9aeebc473b11a3dbfa5b52930b4a8e5a35f22215 100644 (file)
@@ -45,7 +45,6 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
                      long *kvdf, long *kvdb, int need_min, xdpsplit_t *spl,
                      xdalgoenv_t *xenv);
 static xdchange_t *xdl_add_change(xdchange_t *xscr, long i1, long i2, long chg1, long chg2);
-static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo);
 
 
 
@@ -84,7 +83,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
                 * We need to extent the diagonal "domain" by one. If the next
                 * values exits the box boundaries we need to change it in the
                 * opposite direction because (max - min) must be a power of two.
-                * Also we initialize the extenal K value to -1 so that we can
+                * Also we initialize the external K value to -1 so that we can
                 * avoid extra conditions check inside the core loop.
                 */
                if (fmin > dmin)
@@ -119,7 +118,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
                 * We need to extent the diagonal "domain" by one. If the next
                 * values exits the box boundaries we need to change it in the
                 * opposite direction because (max - min) must be a power of two.
-                * Also we initialize the extenal K value to -1 so that we can
+                * Also we initialize the external K value to -1 so that we can
                 * avoid extra conditions check inside the core loop.
                 */
                if (bmin > dmin)
@@ -397,7 +396,7 @@ static xdchange_t *xdl_add_change(xdchange_t *xscr, long i1, long i2, long chg1,
 }
 
 
-static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo) {
+int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
        long ix, ixo, ixs, ixref, grpsiz, nrec = xdf->nrec;
        char *rchg = xdf->rchg, *rchgo = xdfo->rchg;
        xrecord_t **recs = xdf->recs;
@@ -405,7 +404,7 @@ static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo) {
        /*
         * This is the same of what GNU diff does. Move back and forward
         * change groups for a consistent and pretty diff output. This also
-        * helps in finding joineable change groups and reduce the diff size.
+        * helps in finding joinable change groups and reduce the diff size.
         */
        for (ix = ixo = 0;;) {
                /*
@@ -440,7 +439,7 @@ static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo) {
                         * the group.
                         */
                        while (ixs > 0 && recs[ixs - 1]->ha == recs[ix - 1]->ha &&
-                              XDL_RECMATCH(recs[ixs - 1], recs[ix - 1])) {
+                              xdl_recmatch(recs[ixs - 1]->ptr, recs[ixs - 1]->size, recs[ix - 1]->ptr, recs[ix - 1]->size, flags)) {
                                rchg[--ixs] = 1;
                                rchg[--ix] = 0;
 
@@ -468,7 +467,7 @@ static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo) {
                         * the group.
                         */
                        while (ix < nrec && recs[ixs]->ha == recs[ix]->ha &&
-                              XDL_RECMATCH(recs[ixs], recs[ix])) {
+                              xdl_recmatch(recs[ixs]->ptr, recs[ixs]->size, recs[ix]->ptr, recs[ix]->size, flags)) {
                                rchg[ixs++] = 0;
                                rchg[ix++] = 1;
 
@@ -546,8 +545,8 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
 
                return -1;
        }
-       if (xdl_change_compact(&xe.xdf1, &xe.xdf2) < 0 ||
-           xdl_change_compact(&xe.xdf2, &xe.xdf1) < 0 ||
+       if (xdl_change_compact(&xe.xdf1, &xe.xdf2, xpp->flags) < 0 ||
+           xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
            xdl_build_script(&xe, &xscr) < 0) {
 
                xdl_free_env(&xe);