ref: ae724691436df6353bd7732d6255eb931b075daf
parent: bc425258e854c1a09ce3dfabf72c9ba4f9a33efb
author: ozan yigit <ozan.yigit@gmail.com>
date: Sun Apr 21 20:32:24 EDT 2024
fixed a gototab bug that caused unnecessary reallocation. thanks Arnold.
--- a/b.c
+++ b/b.c
@@ -651,8 +651,8 @@
if (tab->inuse + 1 >= tab->allocated)
resize_gototab(f, state);
- f->gototab[state].entries[f->gototab[state].inuse-1].ch = ch;
- f->gototab[state].entries[f->gototab[state].inuse-1].state = val;
+ f->gototab[state].entries[f->gototab[state].inuse].ch = ch;
+ f->gototab[state].entries[f->gototab[state].inuse].state = val;
f->gototab[state].inuse++;
return val;
} else {@@ -677,9 +677,9 @@
gtt *tab = & f->gototab[state];
if (tab->inuse + 1 >= tab->allocated)
resize_gototab(f, state);
- ++tab->inuse;
f->gototab[state].entries[tab->inuse].ch = ch;
f->gototab[state].entries[tab->inuse].state = val;
+ ++tab->inuse;
qsort(f->gototab[state].entries,
f->gototab[state].inuse, sizeof(gtte), entry_cmp);
--
⑨