3434#define INVESTIGATE 2
3535
3636typedef struct s_xdlclass {
37+ uint64_t line_hash ;
3738 struct s_xdlclass * next ;
38- xrecord_t rec ;
39+ const uint8_t * ptr ;
40+ size_t size ;
3941 long idx ;
4042 long len1 , len2 ;
4143} xdlclass_t ;
@@ -92,14 +94,15 @@ static void xdl_free_classifier(xdlclassifier_t *cf) {
9294}
9395
9496
95- static int xdl_classify_record (unsigned int pass , xdlclassifier_t * cf , xrecord_t * rec ) {
97+ static int xdl_classify_record (unsigned int pass , xdlclassifier_t * cf , xrecord_t * rec ,
98+ uint64_t line_hash ) {
9699 size_t hi ;
97100 xdlclass_t * rcrec ;
98101
99- hi = XDL_HASHLONG (rec -> line_hash , cf -> hbits );
102+ hi = XDL_HASHLONG (line_hash , cf -> hbits );
100103 for (rcrec = cf -> rchash [hi ]; rcrec ; rcrec = rcrec -> next )
101- if (rcrec -> rec . line_hash == rec -> line_hash &&
102- xdl_recmatch ((const char * )rcrec -> rec . ptr , (long )rcrec -> rec . size ,
104+ if (rcrec -> line_hash == line_hash &&
105+ xdl_recmatch ((const char * )rcrec -> ptr , (long )rcrec -> size ,
103106 (const char * )rec -> ptr , (long )rec -> size , cf -> flags ))
104107 break ;
105108
@@ -112,7 +115,9 @@ static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t
112115 if (XDL_ALLOC_GROW (cf -> rcrecs , cf -> count , cf -> alloc ))
113116 return -1 ;
114117 cf -> rcrecs [rcrec -> idx ] = rcrec ;
115- rcrec -> rec = * rec ;
118+ rcrec -> line_hash = line_hash ;
119+ rcrec -> ptr = rec -> ptr ;
120+ rcrec -> size = rec -> size ;
116121 rcrec -> len1 = rcrec -> len2 = 0 ;
117122 rcrec -> next = cf -> rchash [hi ];
118123 cf -> rchash [hi ] = rcrec ;
@@ -158,8 +163,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
158163 crec = & xdf -> recs [xdf -> nrec ++ ];
159164 crec -> ptr = prev ;
160165 crec -> size = cur - prev ;
161- crec -> line_hash = hav ;
162- if (xdl_classify_record (pass , cf , crec ) < 0 )
166+ if (xdl_classify_record (pass , cf , crec , hav ) < 0 )
163167 goto abort ;
164168 }
165169 }
0 commit comments