[PATCH v2 5/5] xdiff/xdl_cleanup_records: use unambiguous types
- From
Ezekiel Newren via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 25, 2026, 21:11 UTC
- Message-ID
- <a52787f0194bf9f7d1e0abe024c423b8d93754fc.1774473065.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2156.v2.git.git.1774473065.gitgitgadget@gmail.com>
From: Ezekiel Newren <ezekielnewren@gmail.com>
Change the parameters of xdl_clean_mmatch() and the local variables i, nm in xdl_cleanup_records() to use unambiguous types. Best viewed with --color-words.
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com> --- xdiff/xprepare.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c index dd595cf8a1..39e48ad33a 100644 --- a/xdiff/xprepare.c +++ b/xdiff/xprepare.c @@ -197,8 +197,8 @@ void xdl_free_env(xdfenv_t *xe) { } -static bool xdl_clean_mmatch(uint8_t const *action, long i, long s, long e) { - long r, rdis0, rpdis0, rdis1, rpdis1; +static bool xdl_clean_mmatch(uint8_t const *action, ptrdiff_t i, ptrdiff_t s, ptrdiff_t e) { + ptrdiff_t r, rdis0, rpdis0, rdis1, rpdis1; /* * Limits the window that is examined during the similar-lines @@ -268,8 +268,8 @@ static bool xdl_clean_mmatch(uint8_t const *action, long i, long s, long e) { * might be potentially discarded if they appear in a run of discardable. */ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) { - long i, nm; - size_t mlim1, mlim2; + ptrdiff_t i; + size_t nm, mlim1, mlim2; xdlclass_t *rcrec; uint8_t *action1 = NULL, *action2 = NULL; bool need_min = !!(cf->flags & XDF_NEED_MINIMAL); @@ -303,7 +303,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd 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; + nm = rcrec ? (size_t)rcrec->len2 : 0; if (nm == 0) action1[i] = DISCARD; else if (nm < mlim1) @@ -315,7 +315,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd 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; + nm = rcrec ? (size_t)rcrec->len1 : 0; if (nm == 0) action2[i] = DISCARD; else if (nm < mlim2)
-- gitgitgadget