@@ -91,8 +91,7 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
91
91
}
92
92
93
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 ) {
96
95
long hi ;
97
96
char const * line ;
98
97
xdlclass_t * rcrec ;
@@ -126,43 +125,31 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
126
125
127
126
rec -> ha = (unsigned long ) rcrec -> idx ;
128
127
129
- hi = (long ) XDL_HASHLONG (rec -> ha , hbits );
130
- rec -> next = rhash [hi ];
131
- rhash [hi ] = rec ;
132
-
133
128
return 0 ;
134
129
}
135
130
136
131
137
132
static int xdl_prepare_ctx (unsigned int pass , mmfile_t * mf , long narec , xpparam_t const * xpp ,
138
133
xdlclassifier_t * cf , xdfile_t * xdf ) {
139
- unsigned int hbits ;
140
- long nrec , hsize , bsize ;
134
+ long nrec , bsize ;
141
135
unsigned long hav ;
142
136
char const * blk , * cur , * top , * prev ;
143
137
xrecord_t * crec ;
144
138
xrecord_t * * recs ;
145
- xrecord_t * * rhash ;
146
139
unsigned long * ha ;
147
140
char * rchg ;
148
141
long * rindex ;
149
142
150
143
ha = NULL ;
151
144
rindex = NULL ;
152
145
rchg = NULL ;
153
- rhash = NULL ;
154
146
recs = NULL ;
155
147
156
148
if (xdl_cha_init (& xdf -> rcha , sizeof (xrecord_t ), narec / 4 + 1 ) < 0 )
157
149
goto abort ;
158
150
if (!XDL_ALLOC_ARRAY (recs , narec ))
159
151
goto abort ;
160
152
161
- hbits = xdl_hashbits ((unsigned int ) narec );
162
- hsize = 1 << hbits ;
163
- if (!XDL_CALLOC_ARRAY (rhash , hsize ))
164
- goto abort ;
165
-
166
153
nrec = 0 ;
167
154
if ((cur = blk = xdl_mmfile_first (mf , & bsize ))) {
168
155
for (top = blk + bsize ; cur < top ; ) {
@@ -176,7 +163,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
176
163
crec -> size = (long ) (cur - prev );
177
164
crec -> ha = hav ;
178
165
recs [nrec ++ ] = crec ;
179
- if (xdl_classify_record (pass , cf , rhash , hbits , crec ) < 0 )
166
+ if (xdl_classify_record (pass , cf , crec ) < 0 )
180
167
goto abort ;
181
168
}
182
169
}
@@ -194,8 +181,6 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
194
181
195
182
xdf -> nrec = nrec ;
196
183
xdf -> recs = recs ;
197
- xdf -> hbits = hbits ;
198
- xdf -> rhash = rhash ;
199
184
xdf -> rchg = rchg + 1 ;
200
185
xdf -> rindex = rindex ;
201
186
xdf -> nreff = 0 ;
@@ -209,16 +194,13 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
209
194
xdl_free (ha );
210
195
xdl_free (rindex );
211
196
xdl_free (rchg );
212
- xdl_free (rhash );
213
197
xdl_free (recs );
214
198
xdl_cha_free (& xdf -> rcha );
215
199
return -1 ;
216
200
}
217
201
218
202
219
203
static void xdl_free_ctx (xdfile_t * xdf ) {
220
-
221
- xdl_free (xdf -> rhash );
222
204
xdl_free (xdf -> rindex );
223
205
xdl_free (xdf -> rchg - 1 );
224
206
xdl_free (xdf -> ha );
0 commit comments