@@ -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,43 +125,31 @@ 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
137132static int xdl_prepare_ctx (unsigned int pass , mmfile_t * mf , long narec , xpparam_t const * xpp ,
138133 xdlclassifier_t * cf , xdfile_t * xdf ) {
139- unsigned int hbits ;
140- long nrec , hsize , bsize ;
134+ long nrec , bsize ;
141135 unsigned long hav ;
142136 char const * blk , * cur , * top , * prev ;
143137 xrecord_t * crec ;
144138 xrecord_t * * recs ;
145- xrecord_t * * rhash ;
146139 unsigned long * ha ;
147140 char * rchg ;
148141 long * rindex ;
149142
150143 ha = NULL ;
151144 rindex = NULL ;
152145 rchg = NULL ;
153- rhash = NULL ;
154146 recs = NULL ;
155147
156148 if (xdl_cha_init (& xdf -> rcha , sizeof (xrecord_t ), narec / 4 + 1 ) < 0 )
157149 goto abort ;
158150 if (!XDL_ALLOC_ARRAY (recs , narec ))
159151 goto abort ;
160152
161- hbits = xdl_hashbits ((unsigned int ) narec );
162- hsize = 1 << hbits ;
163- if (!XDL_CALLOC_ARRAY (rhash , hsize ))
164- goto abort ;
165-
166153 nrec = 0 ;
167154 if ((cur = blk = xdl_mmfile_first (mf , & bsize ))) {
168155 for (top = blk + bsize ; cur < top ; ) {
@@ -176,7 +163,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
176163 crec -> size = (long ) (cur - prev );
177164 crec -> ha = hav ;
178165 recs [nrec ++ ] = crec ;
179- if (xdl_classify_record (pass , cf , rhash , hbits , crec ) < 0 )
166+ if (xdl_classify_record (pass , cf , crec ) < 0 )
180167 goto abort ;
181168 }
182169 }
@@ -194,8 +181,6 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
194181
195182 xdf -> nrec = nrec ;
196183 xdf -> recs = recs ;
197- xdf -> hbits = hbits ;
198- xdf -> rhash = rhash ;
199184 xdf -> rchg = rchg + 1 ;
200185 xdf -> rindex = rindex ;
201186 xdf -> nreff = 0 ;
@@ -209,16 +194,13 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
209194 xdl_free (ha );
210195 xdl_free (rindex );
211196 xdl_free (rchg );
212- xdl_free (rhash );
213197 xdl_free (recs );
214198 xdl_cha_free (& xdf -> rcha );
215199 return -1 ;
216200}
217201
218202
219203static void xdl_free_ctx (xdfile_t * xdf ) {
220-
221- xdl_free (xdf -> rhash );
222204 xdl_free (xdf -> rindex );
223205 xdl_free (xdf -> rchg - 1 );
224206 xdl_free (xdf -> ha );
0 commit comments