# HG changeset patch # User Jun Wu # Date 1520191816 28800 # Node ID 0c7350656f935e00d0ecbe7988d9fc185f94a5e4 # Parent f33a87cf60ccb8b46e06b85e60bc5031420707d6 xdiff: add comments for fields in xdfile_t This makes the related code easier to understand. Differential Revision: https://phab.mercurial-scm.org/D2685 diff -r f33a87cf60cc -r 0c7350656f93 mercurial/thirdparty/xdiff/xtypes.h --- a/mercurial/thirdparty/xdiff/xtypes.h Wed Mar 07 14:45:31 2018 -0800 +++ b/mercurial/thirdparty/xdiff/xtypes.h Sun Mar 04 11:30:16 2018 -0800 @@ -46,15 +46,49 @@ } xrecord_t; typedef struct s_xdfile { + /* manual memory management */ chastore_t rcha; + + /* number of records (lines) */ long nrec; + + /* hash table size + * the maximum hash value in the table is (1 << hbits) */ unsigned int hbits; + + /* hash table, hash value => xrecord_t + * note: xrecord_t is a linked list. */ xrecord_t **rhash; + + /* range excluding common prefix and suffix + * [recs[i] for i in range(0, dstart)] are common prefix. + * [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting + * lines */ long dstart, dend; + + /* pointer to records (lines) */ xrecord_t **recs; + + /* record changed, use original "recs" index + * rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked + * "changed". */ char *rchg; + + /* cleaned-up record index => original "recs" index + * clean-up means: + * rule 1. remove common prefix and suffix + * rule 2. remove records that are only on one side, since they can + * not match the other side + * rindex[0] is likely dstart, if not removed up by rule 2. + * rindex[nreff - 1] is likely dend, if not removed by rule 2. + */ long *rindex; + + /* rindex size */ long nreff; + + /* cleaned-up record index => hash value + * ha[i] = recs[rindex[i]]->ha */ unsigned long *ha; } xdfile_t;