xdiff: delete unnecessary fields from xrecord_t and xdfile_t
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>
Ezekiel Newren committed
Sep 26, 2025 at 22:41 UTC
efaf553b1a4ea9cafcb9cab0697157091bc4825a
2 files changed
+2
-16
xdiff/xprepare.c
+2
-13
@@ -91,8 +91,7 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
91
}
92
93
94
-static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t **rhash,
95
- unsigned int hbits, xrecord_t *rec) {
94
+static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t *rec) {
95
long hi;
96
char const *line;
97
xdlclass_t *rcrec;
@@ -126,17 +125,12 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
125
126
rec->ha = (unsigned long) rcrec->idx;
127
129
- hi = (long) XDL_HASHLONG(rec->ha, hbits);
130
- rec->next = rhash[hi];
131
- rhash[hi] = rec;
132
-
128
return 0;
129
}
130
131
132
static void xdl_free_ctx(xdfile_t *xdf)
133
{
139
- xdl_free(xdf->rhash);
134
xdl_free(xdf->rindex);
135
xdl_free(xdf->rchg - 1);
136
xdl_free(xdf->ha);
@@ -155,7 +149,6 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
149
xdf->ha = NULL;
150
xdf->rindex = NULL;
151
xdf->rchg = NULL;
158
- xdf->rhash = NULL;
152
xdf->recs = NULL;
153
154
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_
156
if (!XDL_ALLOC_ARRAY(xdf->recs, narec))
157
goto abort;
158
166
- xdf->hbits = xdl_hashbits((unsigned int) narec);
167
- if (!XDL_CALLOC_ARRAY(xdf->rhash, 1 << xdf->hbits))
168
- goto abort;
169
-
159
xdf->nrec = 0;
160
if ((cur = blk = xdl_mmfile_first(mf, &bsize))) {
161
for (top = blk + bsize; cur < top; ) {
@@ -180,7 +169,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
169
crec->size = (long) (cur - prev);
170
crec->ha = hav;
171
xdf->recs[xdf->nrec++] = crec;
183
- if (xdl_classify_record(pass, cf, xdf->rhash, xdf->hbits, crec) < 0)
172
+ if (xdl_classify_record(pass, cf, crec) < 0)
173
goto abort;
174
}
175
}
xdiff/xtypes.h
-3
@@ -39,7 +39,6 @@ typedef struct s_chastore {
39
} chastore_t;
40
41
typedef struct s_xrecord {
42
- struct s_xrecord *next;
42
char const *ptr;
43
long size;
44
unsigned long ha;
@@ -48,8 +47,6 @@ typedef struct s_xrecord {
47
typedef struct s_xdfile {
48
chastore_t rcha;
49
long nrec;
51
- unsigned int hbits;
52
- xrecord_t **rhash;
50
long dstart, dend;
51
xrecord_t **recs;
52
char *rchg;