Git fork

xdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t

The fields from xdlclass_t are aliases of xrecord_t:
xdlclass_t.line -> xrecord_t.ptr
xdlclass_t.size -> xrecord_t.size
xdlclass_t.ha -> xrecord_t.ha

xdlclass_t carries a copy of the data in xrecord_t, but instead of
embedding xrecord_t it duplicates the individual fields. A future
commit will change the types used in xrecord_t so embed it in
xdlclass_t first, so we don't have to remember to change the types
here as well.

Best-viewed-with: --color-words
Helped-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Ezekiel Newren and committed by
Junio C Hamano
6d507bd4 5c294dce

+4 -10
+4 -10
xdiff/xprepare.c
··· 32 32 33 33 typedef struct s_xdlclass { 34 34 struct s_xdlclass *next; 35 - unsigned long ha; 36 - char const *line; 37 - long size; 35 + xrecord_t rec; 38 36 long idx; 39 37 long len1, len2; 40 38 } xdlclass_t; ··· 93 91 94 92 static int xdl_classify_record(unsigned int pass, xdlclassifier_t *cf, xrecord_t *rec) { 95 93 long hi; 96 - char const *line; 97 94 xdlclass_t *rcrec; 98 95 99 - line = rec->ptr; 100 96 hi = (long) XDL_HASHLONG(rec->ha, cf->hbits); 101 97 for (rcrec = cf->rchash[hi]; rcrec; rcrec = rcrec->next) 102 - if (rcrec->ha == rec->ha && 103 - xdl_recmatch(rcrec->line, rcrec->size, 98 + if (rcrec->rec.ha == rec->ha && 99 + xdl_recmatch(rcrec->rec.ptr, rcrec->rec.size, 104 100 rec->ptr, rec->size, cf->flags)) 105 101 break; 106 102 ··· 113 109 if (XDL_ALLOC_GROW(cf->rcrecs, cf->count, cf->alloc)) 114 110 return -1; 115 111 cf->rcrecs[rcrec->idx] = rcrec; 116 - rcrec->line = line; 117 - rcrec->size = rec->size; 118 - rcrec->ha = rec->ha; 112 + rcrec->rec = *rec; 119 113 rcrec->len1 = rcrec->len2 = 0; 120 114 rcrec->next = cf->rchash[hi]; 121 115 cf->rchash[hi] = rcrec;