Re: [PATCH 07/17] xdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t
- From
Elijah Newren <newren@gmail.com>
- Date
- Sep 9, 2025, 08:57 UTC
- Message-ID
- <CABPp-BGpWoi9naKYMPuL1SXZMb1bAVhAvd8DT5DEfrxHCB5uvw@mail.gmail.com>
- In-Reply-To
- <db3d4e9a89d4b72dfb7e59dd38c6dad31f5c1cf0.1757274320.git.gitgitgadget@gmail.com>
On Sun, Sep 7, 2025 at 12:46 PM Ezekiel Newren via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 55 quoted lines
>
> From: Ezekiel Newren <ezekielnewren@gmail.com>
>
> Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
> ---
> xdiff/xprepare.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c
> index 59730989a3..6f1d4b4725 100644
> --- a/xdiff/xprepare.c
> +++ b/xdiff/xprepare.c
> @@ -32,9 +32,7 @@
>
> typedef struct s_xdlclass {
> struct s_xdlclass *next;
> - unsigned long ha;
> - char const *line;
> - long size;
> + xrecord_t rec;
> long idx;
> long len1, len2;
> } xdlclass_t;
> @@ -93,14 +91,12 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
>
> static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t *rec) {
> long hi;
> - char const *line;
> xdlclass_t *rcrec;
>
> - line = rec->ptr;
> hi = (long) XDL_HASHLONG(rec->ha, cf->hbits);
> for (rcrec = cf->rchash[hi]; rcrec; rcrec = rcrec->next)
> - if (rcrec->ha == rec->ha &&
> - xdl_recmatch(rcrec->line, rcrec->size,
> + if (rcrec->rec.ha == rec->ha &&
> + xdl_recmatch(rcrec->rec.ptr, rcrec->rec.size,
> rec->ptr, rec->size, cf->flags))
> break;
>
> @@ -113,9 +109,9 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
> if (XDL_ALLOC_GROW(cf->rcrecs, cf->count, cf->alloc))
> return -1;
> cf->rcrecs[rcrec->idx] = rcrec;
> - rcrec->line = line;
> - rcrec->size = rec->size;
> - rcrec->ha = rec->ha;
> + rcrec->rec.ptr = rec->ptr;
> + rcrec->rec.size = rec->size;
> + rcrec->rec.ha = rec->ha;
> rcrec->len1 = rcrec->len2 = 0;
> rcrec->next = cf->rchash[hi];
> cf->rchash[hi] = rcrec;
> --
> gitgitgadgetI can see the changes match the one-line summary. And I think the point is simplification or reducing redundancy or something...but could a single sentence motivation (stating which of these purposes is at play) be added to the commit message?