correct sdense

This commit is contained in:
Kyryl Melekhin
2022-01-06 21:37:47 +00:00
parent 915680e057
commit 281820d7c9

11
pike.c
View File

@@ -392,7 +392,7 @@ int re_comp(rcode *prog, const char *re, int nsubs)
if (res < 0) return res;
// If unparsed chars left
if (*re) return RE_SYNTAX_ERROR;
int icnt = 0, scnt = SPLIT + 1;
int icnt = 0, scnt = SPLIT;
for (int i = 0; i < prog->unilen; i++)
switch (prog->insts[i]) {
case CLASS:
@@ -440,11 +440,10 @@ if (--csub->ref == 0) { \
#define onclist(nn)
#define onnlist(nn) \
if (sdense[spc] < sparsesz) \
if (sdense[sdense[spc]] == (unsigned int)spc) \
if (sdense[sdense[spc] * 2] == (unsigned int)spc) \
deccheck(nn) \
sdense[spc] = sparsesz; \
sdense[sparsesz] = spc; \
sparsesz += 2; \
sdense[sparsesz++ * 2] = spc; \
#define fastrec(nn, list, listidx) \
nsub->ref++; \
@@ -500,13 +499,13 @@ spc = *npc; \
if ((unsigned int)spc < WBEG) { \
list[listidx].sub = nsub; \
list[listidx++].pc = npc; \
list##match() \
rec_check##nn: \
if (si) { \
npc = pcs[--si]; \
nsub = subs[si]; \
goto rec##nn; \
} \
list##match() \
continue; \
} \
next##nn: \
@@ -574,7 +573,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
for (;; sp = _sp) {
uc_len(i, sp) uc_code(c, sp)
_sp = sp+i;
nlistidx = 0; sparsesz = SPLIT;
nlistidx = 0; sparsesz = 0;
for (i = 0; i < clistidx; i++) {
npc = clist[i].pc;
nsub = clist[i].sub;