]> git.ipfire.org Git - thirdparty/git.git/commitdiff
xdiff: delete unnecessary fields from xrecord_t and xdfile_t
authorEzekiel Newren <ezekielnewren@gmail.com>
Fri, 26 Sep 2025 22:41:50 +0000 (22:41 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Sep 2025 23:08:55 +0000 (16:08 -0700)
xrecord_t.next, xdfile_t.hbits, xdfile_t.rhash are initialized,
but never used for anything by the code. Remove them.

Best-viewed-with: --color-words
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xprepare.c
xdiff/xtypes.h

index 96134c9fbfe2437b4d2f9163c9a920892f2b6288..3576415c85cb7a696ea1620d60651823a6bc8526 100644 (file)
@@ -91,8 +91,7 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
 }
 
 
-static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t **rhash,
-                              unsigned int hbits, xrecord_t *rec) {
+static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t *rec) {
        long hi;
        char const *line;
        xdlclass_t *rcrec;
@@ -126,17 +125,12 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
 
        rec->ha = (unsigned long) rcrec->idx;
 
-       hi = (long) XDL_HASHLONG(rec->ha, hbits);
-       rec->next = rhash[hi];
-       rhash[hi] = rec;
-
        return 0;
 }
 
 
 static void xdl_free_ctx(xdfile_t *xdf)
 {
-       xdl_free(xdf->rhash);
        xdl_free(xdf->rindex);
        xdl_free(xdf->rchg - 1);
        xdl_free(xdf->ha);
@@ -155,7 +149,6 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
        xdf->ha = NULL;
        xdf->rindex = NULL;
        xdf->rchg = NULL;
-       xdf->rhash = NULL;
        xdf->recs = NULL;
 
        if (xdl_cha_init(&xdf->rcha, sizeof(xrecord_t), narec / 4 + 1) < 0)
@@ -163,10 +156,6 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
        if (!XDL_ALLOC_ARRAY(xdf->recs, narec))
                goto abort;
 
-       xdf->hbits = xdl_hashbits((unsigned int) narec);
-       if (!XDL_CALLOC_ARRAY(xdf->rhash, 1 << xdf->hbits))
-               goto abort;
-
        xdf->nrec = 0;
        if ((cur = blk = xdl_mmfile_first(mf, &bsize))) {
                for (top = blk + bsize; cur < top; ) {
@@ -180,7 +169,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
                        crec->size = (long) (cur - prev);
                        crec->ha = hav;
                        xdf->recs[xdf->nrec++] = crec;
-                       if (xdl_classify_record(pass, cf, xdf->rhash, xdf->hbits, crec) < 0)
+                       if (xdl_classify_record(pass, cf, crec) < 0)
                                goto abort;
                }
        }
index 8442bd436efeab81afc25db9d89da082638fcca4..8b8467360ecfc0e368e8a8abeb6f61d55063b0c0 100644 (file)
@@ -39,7 +39,6 @@ typedef struct s_chastore {
 } chastore_t;
 
 typedef struct s_xrecord {
-       struct s_xrecord *next;
        char const *ptr;
        long size;
        unsigned long ha;
@@ -48,8 +47,6 @@ typedef struct s_xrecord {
 typedef struct s_xdfile {
        chastore_t rcha;
        long nrec;
-       unsigned int hbits;
-       xrecord_t **rhash;
        long dstart, dend;
        xrecord_t **recs;
        char *rchg;