[PATCH v4 0/6] Xdiff cleanup part 3
- From
Ezekiel Newren via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 30, 2026, 16:59 UTC
- Message-ID
- <pull.2156.v4.git.git.1774890003.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2156.v3.git.git.1774639433.gitgitgadget@gmail.com>
Changes in v3:
* run make DEVELOPER=1 on each commit and fix all compiler issues
v2 is a radical departure from v1 Changes in v2:
* make the flow of xdl_cleanup_records() easier to follow
There is no performance or behavioral change introduced in this patch series.
=== original cover letter bellow ===
Patch series summary:
* patch 1: Introduce the ivec type * patch 2: Create the function xdl_do_classic_diff() * patches 3-4: generic cleanup * patches 5-8: convert from dstart/dend (in xdfile_t) to delta_start/delta_end (in xdfenv_t) * patches 9-10: move xdl_cleanup_records(), and related, from xprepare.c to xdiffi.c
Things that will be addressed in future patch series:
* Make xdl_cleanup_records() easier to read * convert recs/nrec into an ivec * convert changed to an ivec * remove reference_index/nreff from xdfile_t and turn it into an ivec * splitting minimal_perfect_hash out as its own ivec * improve the performance of the classifier and parsing/hashing lines
=== before this patch series typedef struct s_xdfile { xrecord_t *recs; size_t nrec; ptrdiff_t dstart, dend; bool *changed; size_t *reference_index; size_t nreff; } xdfile_t;
typedef struct s_xdfenv { xdfile_t xdf1, xdf2; } xdfenv_t;=== after this patch series typedef struct s_xdfile { xrecord_t *recs; size_t nrec; bool *changed; size_t *reference_index; size_t nreff; } xdfile_t;
typedef struct s_xdfenv { xdfile_t xdf1, xdf2; size_t delta_start, delta_end; size_t mph_size; } xdfenv_t;
Ezekiel Newren (6): xdiff/xdl_cleanup_records: delete local recs pointer xdiff: use unambiguous types in xdl_bogo_sqrt() xdiff/xdl_cleanup_records: use unambiguous types xdiff/xdl_cleanup_records: make limits more clear xdiff/xdl_cleanup_records: make setting action easier to follow xdiff/xdl_cleanup_records: simplify INVESTIGATE handling for clarity
xdiff/xdiffi.c | 2 +- xdiff/xprepare.c | 84 ++++++++++++++++++++++++++++++++---------------- xdiff/xutils.c | 4 +-- xdiff/xutils.h | 2 +- 4 files changed, 60 insertions(+), 32 deletions(-)
base-commit: ca1db8a0f7dc0dbea892e99f5b37c5fe5861be71 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2156%2Fezekielnewren%2Fxdiff-cleanup-3-v4 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2156/ezekielnewren/xdiff-cleanup-3-v4 Pull-Request: https://github.com/git/git/pull/2156
Range-diff vs v3:
1: da32a9747c = 1: da32a9747c xdiff/xdl_cleanup_records: delete local recs pointer
2: 86b0ad100c = 2: 86b0ad100c xdiff: use unambiguous types in xdl_bogo_sqrt()
3: 39a35365ae = 3: 39a35365ae xdiff/xdl_cleanup_records: use unambiguous types
4: 86dd98db9b ! 4: 75fe3ea125 xdiff/xdl_cleanup_records: make limits more clear
@@ xdiff/xprepare.c: static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *
+ if (need_min) {
+ /* i.e. infinity */
-+ mlim1 = SIZE_MAX;
-+ mlim2 = SIZE_MAX;
++ mlim1 = PTRDIFF_MAX;
++ mlim2 = PTRDIFF_MAX;
+ } else {
+ mlim1 = XDL_MIN(xdl_bogosqrt(xdf1->nrec), XDL_MAX_EQLIMIT);
+ mlim2 = XDL_MIN(xdl_bogosqrt(xdf2->nrec), XDL_MAX_EQLIMIT);
5: ecc25be32f = 5: 0cf1412d01 xdiff/xdl_cleanup_records: make setting action easier to follow
6: 8f4def8814 = 6: fd14ccafc4 xdiff/xdl_cleanup_records: simplify INVESTIGATE handling for clarity-- gitgitgadget