xdiff: rename rindex -> reference_index
The classic diff adds only the lines that it's going to consider, during the diff, to an array. A mapping between the compacted array, and the lines of the file that they reference, is facilitated by this array. Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>main
parent
5004a8da14
commit
22ce0cb639
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
static size_t get_hash(xdfile_t *xdf, long index)
|
static size_t get_hash(xdfile_t *xdf, long index)
|
||||||
{
|
{
|
||||||
return xdf->recs[xdf->rindex[index]].minimal_perfect_hash;
|
return xdf->recs[xdf->reference_index[index]].minimal_perfect_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XDL_MAX_COST_MIN 256
|
#define XDL_MAX_COST_MIN 256
|
||||||
|
|
@ -278,10 +278,10 @@ int xdl_recs_cmp(xdfile_t *xdf1, long off1, long lim1,
|
||||||
*/
|
*/
|
||||||
if (off1 == lim1) {
|
if (off1 == lim1) {
|
||||||
for (; off2 < lim2; off2++)
|
for (; off2 < lim2; off2++)
|
||||||
xdf2->changed[xdf2->rindex[off2]] = true;
|
xdf2->changed[xdf2->reference_index[off2]] = true;
|
||||||
} else if (off2 == lim2) {
|
} else if (off2 == lim2) {
|
||||||
for (; off1 < lim1; off1++)
|
for (; off1 < lim1; off1++)
|
||||||
xdf1->changed[xdf1->rindex[off1]] = true;
|
xdf1->changed[xdf1->reference_index[off1]] = true;
|
||||||
} else {
|
} else {
|
||||||
xdpsplit_t spl;
|
xdpsplit_t spl;
|
||||||
spl.i1 = spl.i2 = 0;
|
spl.i1 = spl.i2 = 0;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
|
||||||
|
|
||||||
static void xdl_free_ctx(xdfile_t *xdf)
|
static void xdl_free_ctx(xdfile_t *xdf)
|
||||||
{
|
{
|
||||||
xdl_free(xdf->rindex);
|
xdl_free(xdf->reference_index);
|
||||||
xdl_free(xdf->changed - 1);
|
xdl_free(xdf->changed - 1);
|
||||||
xdl_free(xdf->recs);
|
xdl_free(xdf->recs);
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +141,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
|
||||||
uint8_t const *blk, *cur, *top, *prev;
|
uint8_t const *blk, *cur, *top, *prev;
|
||||||
xrecord_t *crec;
|
xrecord_t *crec;
|
||||||
|
|
||||||
xdf->rindex = NULL;
|
xdf->reference_index = NULL;
|
||||||
xdf->changed = NULL;
|
xdf->changed = NULL;
|
||||||
xdf->recs = NULL;
|
xdf->recs = NULL;
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
|
||||||
|
|
||||||
if ((XDF_DIFF_ALG(xpp->flags) != XDF_PATIENCE_DIFF) &&
|
if ((XDF_DIFF_ALG(xpp->flags) != XDF_PATIENCE_DIFF) &&
|
||||||
(XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF)) {
|
(XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF)) {
|
||||||
if (!XDL_ALLOC_ARRAY(xdf->rindex, xdf->nrec + 1))
|
if (!XDL_ALLOC_ARRAY(xdf->reference_index, xdf->nrec + 1))
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +312,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
|
||||||
i <= xdf1->dend; i++, recs++) {
|
i <= xdf1->dend; i++, recs++) {
|
||||||
if (action1[i] == KEEP ||
|
if (action1[i] == KEEP ||
|
||||||
(action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, xdf1->dstart, xdf1->dend))) {
|
(action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, xdf1->dstart, xdf1->dend))) {
|
||||||
xdf1->rindex[xdf1->nreff++] = i;
|
xdf1->reference_index[xdf1->nreff++] = i;
|
||||||
/* changed[i] remains false, i.e. keep */
|
/* changed[i] remains false, i.e. keep */
|
||||||
} else
|
} else
|
||||||
xdf1->changed[i] = true;
|
xdf1->changed[i] = true;
|
||||||
|
|
@ -324,7 +324,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
|
||||||
i <= xdf2->dend; i++, recs++) {
|
i <= xdf2->dend; i++, recs++) {
|
||||||
if (action2[i] == KEEP ||
|
if (action2[i] == KEEP ||
|
||||||
(action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, xdf2->dstart, xdf2->dend))) {
|
(action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, xdf2->dstart, xdf2->dend))) {
|
||||||
xdf2->rindex[xdf2->nreff++] = i;
|
xdf2->reference_index[xdf2->nreff++] = i;
|
||||||
/* changed[i] remains false, i.e. keep */
|
/* changed[i] remains false, i.e. keep */
|
||||||
} else
|
} else
|
||||||
xdf2->changed[i] = true;
|
xdf2->changed[i] = true;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ typedef struct s_xdfile {
|
||||||
size_t nrec;
|
size_t nrec;
|
||||||
ptrdiff_t dstart, dend;
|
ptrdiff_t dstart, dend;
|
||||||
bool *changed;
|
bool *changed;
|
||||||
size_t *rindex;
|
size_t *reference_index;
|
||||||
size_t nreff;
|
size_t nreff;
|
||||||
} xdfile_t;
|
} xdfile_t;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue