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>

Ezekiel Newren committed Apr 29, 2026 at 22:08 UTC b7b8449e5ae7c6a0bb3e87c82d9dd6fd382baf62
1 file changed +8 -9
xdiff/xprepare.c
+8 -9
@@ -269,7 +269,6 @@ static bool xdl_clean_mmatch(uint8_t const *action, long i, long s, long e) {
269 */
270 static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) {
271 long i, nm, mlim;
272 - xrecord_t *recs;
272 xdlclass_t *rcrec;
273 uint8_t *action1 = NULL, *action2 = NULL;
274 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
292 */
293 if ((mlim = xdl_bogosqrt((long)xdf1->nrec)) > XDL_MAX_EQLIMIT)
294 mlim = XDL_MAX_EQLIMIT;
296 - for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart]; i <= xdf1->dend; i++, recs++) {
297 - rcrec = cf->rcrecs[recs->minimal_perfect_hash];
295 + for (i = xdf1->dstart; i <= xdf1->dend; i++) {
296 + size_t mph1 = xdf1->recs[i].minimal_perfect_hash;
297 + rcrec = cf->rcrecs[mph1];
298 nm = rcrec ? rcrec->len2 : 0;
299 action1[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP;
300 }
301
302 if ((mlim = xdl_bogosqrt((long)xdf2->nrec)) > XDL_MAX_EQLIMIT)
303 mlim = XDL_MAX_EQLIMIT;
304 - for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart]; i <= xdf2->dend; i++, recs++) {
305 - rcrec = cf->rcrecs[recs->minimal_perfect_hash];
304 + for (i = xdf2->dstart; i <= xdf2->dend; i++) {
305 + size_t mph2 = xdf2->recs[i].minimal_perfect_hash;
306 + rcrec = cf->rcrecs[mph2];
307 nm = rcrec ? rcrec->len1 : 0;
308 action2[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP;
309 }
@@ -312,8 +313,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
313 * false, or become true.
314 */
315 xdf1->nreff = 0;
315 - for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart];
316 - i <= xdf1->dend; i++, recs++) {
316 + for (i = xdf1->dstart; i <= xdf1->dend; i++) {
317 if (action1[i] == KEEP ||
318 (action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, xdf1->dstart, xdf1->dend))) {
319 xdf1->reference_index[xdf1->nreff++] = i;
@@ -324,8 +324,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
324 }
325
326 xdf2->nreff = 0;
327 - for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart];
328 - i <= xdf2->dend; i++, recs++) {
327 + for (i = xdf2->dstart; i <= xdf2->dend; i++) {
328 if (action2[i] == KEEP ||
329 (action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, xdf2->dstart, xdf2->dend))) {
330 xdf2->reference_index[xdf2->nreff++] = i;