61
* initially, "next" reflects only the order in file1.
62
*/
63
struct entry *next, *previous;
64
-
65
- /*
66
- * If 1, this entry can serve as an anchor. See
67
- * Documentation/diff-options.adoc for more information.
68
- */
69
- unsigned anchor : 1;
64
} *entries, *first, *last;
65
/* were common records found? */
66
unsigned long has_matches;
79
}
80
81
/* The argument "pass" is 1 for the first file, 2 for the second. */
88
-static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
89
- int pass)
82
+static void insert_record(int line, struct hashmap *map, int pass)
83
{
84
xrecord_t *records = pass == 1 ?
85
map->env->xdf1.recs : map->env->xdf2.recs;
114
return;
115
map->entries[index].line1 = line;
116
map->entries[index].minimal_perfect_hash = record->minimal_perfect_hash;
124
- map->entries[index].anchor = is_anchor(xpp, (const char *)map->env->xdf1.recs[line - 1].ptr);
117
if (!map->first)
118
map->first = map->entries + index;
119
if (map->last) {
145
146
/* First, fill with entries from the first file */
147
while (count1--)
156
- insert_record(xpp, line1++, result, 1);
148
+ insert_record(line1++, result, 1);
149
150
/* Then search for matches in the second file */
151
while (count2--)
160
- insert_record(xpp, line2++, result, 2);
152
+ insert_record(line2++, result, 2);
153
154
return 0;
155
}
186
*/
187
static int find_longest_common_sequence(struct hashmap *map, struct entry **res)
188
{
189
+ xpparam_t const *xpp = map->xpp;
190
+ xrecord_t const *recs = map->env->xdf2.recs;
191
struct entry **sequence;
192
int longest = 0, i;
193
struct entry *entry;
214
if (i <= anchor_i)
215
continue;
216
sequence[i] = entry;
223
- if (entry->anchor) {
217
+ if (is_anchor(xpp, (const char*)recs[entry->line2 - 1].ptr)) {
218
anchor_i = i;
219
longest = anchor_i + 1;
220
} else if (i == longest) {