mirror of
https://github.com/git/git.git
synced 2026-05-31 11:19:02 +02:00
xdiff/xdl_cleanup_records: delete local recs pointer
Simplify the first 2 for loops by directly indexing the xdfile.recs. recs is unused in the last 2 for loops, remove it. Best viewed with --color-words. Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
ca1db8a0f7
commit
b7b8449e5a
+8
-9
@@ -269,7 +269,6 @@ static bool xdl_clean_mmatch(uint8_t const *action, long i, long s, long e) {
|
||||
*/
|
||||
static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) {
|
||||
long i, nm, mlim;
|
||||
xrecord_t *recs;
|
||||
xdlclass_t *rcrec;
|
||||
uint8_t *action1 = NULL, *action2 = NULL;
|
||||
bool need_min = !!(cf->flags & XDF_NEED_MINIMAL);
|
||||
@@ -293,16 +292,18 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
|
||||
*/
|
||||
if ((mlim = xdl_bogosqrt((long)xdf1->nrec)) > XDL_MAX_EQLIMIT)
|
||||
mlim = XDL_MAX_EQLIMIT;
|
||||
for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart]; i <= xdf1->dend; i++, recs++) {
|
||||
rcrec = cf->rcrecs[recs->minimal_perfect_hash];
|
||||
for (i = xdf1->dstart; i <= xdf1->dend; i++) {
|
||||
size_t mph1 = xdf1->recs[i].minimal_perfect_hash;
|
||||
rcrec = cf->rcrecs[mph1];
|
||||
nm = rcrec ? rcrec->len2 : 0;
|
||||
action1[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP;
|
||||
}
|
||||
|
||||
if ((mlim = xdl_bogosqrt((long)xdf2->nrec)) > XDL_MAX_EQLIMIT)
|
||||
mlim = XDL_MAX_EQLIMIT;
|
||||
for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart]; i <= xdf2->dend; i++, recs++) {
|
||||
rcrec = cf->rcrecs[recs->minimal_perfect_hash];
|
||||
for (i = xdf2->dstart; i <= xdf2->dend; i++) {
|
||||
size_t mph2 = xdf2->recs[i].minimal_perfect_hash;
|
||||
rcrec = cf->rcrecs[mph2];
|
||||
nm = rcrec ? rcrec->len1 : 0;
|
||||
action2[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP;
|
||||
}
|
||||
@@ -312,8 +313,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
|
||||
* false, or become true.
|
||||
*/
|
||||
xdf1->nreff = 0;
|
||||
for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart];
|
||||
i <= xdf1->dend; i++, recs++) {
|
||||
for (i = xdf1->dstart; i <= xdf1->dend; i++) {
|
||||
if (action1[i] == KEEP ||
|
||||
(action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, xdf1->dstart, xdf1->dend))) {
|
||||
xdf1->reference_index[xdf1->nreff++] = i;
|
||||
@@ -324,8 +324,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
|
||||
}
|
||||
|
||||
xdf2->nreff = 0;
|
||||
for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart];
|
||||
i <= xdf2->dend; i++, recs++) {
|
||||
for (i = xdf2->dstart; i <= xdf2->dend; i++) {
|
||||
if (action2[i] == KEEP ||
|
||||
(action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, xdf2->dstart, xdf2->dend))) {
|
||||
xdf2->reference_index[xdf2->nreff++] = i;
|
||||
|
||||
Reference in New Issue
Block a user