Skip to content

Commit efaf553

Browse files
ezekielnewrengitster
authored andcommitted
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>
1 parent d1c028b commit efaf553

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

xdiff/xprepare.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
9191
}
9292

9393

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) {
9695
long hi;
9796
char const *line;
9897
xdlclass_t *rcrec;
@@ -126,17 +125,12 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
126125

127126
rec->ha = (unsigned long) rcrec->idx;
128127

129-
hi = (long) XDL_HASHLONG(rec->ha, hbits);
130-
rec->next = rhash[hi];
131-
rhash[hi] = rec;
132-
133128
return 0;
134129
}
135130

136131

137132
static void xdl_free_ctx(xdfile_t *xdf)
138133
{
139-
xdl_free(xdf->rhash);
140134
xdl_free(xdf->rindex);
141135
xdl_free(xdf->rchg - 1);
142136
xdl_free(xdf->ha);
@@ -155,18 +149,13 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
155149
xdf->ha = NULL;
156150
xdf->rindex = NULL;
157151
xdf->rchg = NULL;
158-
xdf->rhash = NULL;
159152
xdf->recs = NULL;
160153

161154
if (xdl_cha_init(&xdf->rcha, sizeof(xrecord_t), narec / 4 + 1) < 0)
162155
goto abort;
163156
if (!XDL_ALLOC_ARRAY(xdf->recs, narec))
164157
goto abort;
165158

166-
xdf->hbits = xdl_hashbits((unsigned int) narec);
167-
if (!XDL_CALLOC_ARRAY(xdf->rhash, 1 << xdf->hbits))
168-
goto abort;
169-
170159
xdf->nrec = 0;
171160
if ((cur = blk = xdl_mmfile_first(mf, &bsize))) {
172161
for (top = blk + bsize; cur < top; ) {
@@ -180,7 +169,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
180169
crec->size = (long) (cur - prev);
181170
crec->ha = hav;
182171
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)
184173
goto abort;
185174
}
186175
}

xdiff/xtypes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ typedef struct s_chastore {
3939
} chastore_t;
4040

4141
typedef struct s_xrecord {
42-
struct s_xrecord *next;
4342
char const *ptr;
4443
long size;
4544
unsigned long ha;
@@ -48,8 +47,6 @@ typedef struct s_xrecord {
4847
typedef struct s_xdfile {
4948
chastore_t rcha;
5049
long nrec;
51-
unsigned int hbits;
52-
xrecord_t **rhash;
5350
long dstart, dend;
5451
xrecord_t **recs;
5552
char *rchg;

0 commit comments

Comments
 (0)