Fix bug in table growing routine
This commit is contained in:
parent
34fee99232
commit
232295fff4
@ -160,13 +160,17 @@ static void insert(table_t *table, int *nfa_states, int count, int dfa_state)
|
|||||||
table->entries = calloc(table->capacity, sizeof(table_entry_t));
|
table->entries = calloc(table->capacity, sizeof(table_entry_t));
|
||||||
assert(NULL != table->entries);
|
assert(NULL != table->entries);
|
||||||
for (int i = 0; i < old_capacity; ++i) {
|
for (int i = 0; i < old_capacity; ++i) {
|
||||||
if (0 != entries[i].nfa_state_count)
|
if (0 != entries[i].nfa_state_count) {
|
||||||
continue;
|
insert(
|
||||||
insert(
|
table, entries[i].nfa_states, entries[i].nfa_state_count,
|
||||||
table, entries[i].nfa_states, entries[i].nfa_state_count,
|
entries[i].dfa_state);
|
||||||
entries[i].dfa_state);
|
}
|
||||||
}
|
}
|
||||||
free(entries);
|
free(entries);
|
||||||
|
|
||||||
|
// Recurse to insert the entry now that the table has been
|
||||||
|
// expanded.
|
||||||
|
insert(table, nfa_states, count, dfa_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool lookup_or_create(
|
static bool lookup_or_create(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user