This commit is contained in:
Kyryl Melekhin
2021-07-30 21:53:32 +00:00
parent 080d93af2e
commit 668127891c

8
pike.c
View File

@@ -449,7 +449,7 @@ int re_comp(rcode *prog, const char *re)
return RE_SUCCESS; return RE_SUCCESS;
} }
#define save(nn, csub) \ #define newsub(csub) \
if (csub->ref > 1) { \ if (csub->ref > 1) { \
s1 = freesub; \ s1 = freesub; \
if (s1) \ if (s1) \
@@ -509,7 +509,7 @@ if (--csub->ref == 0) { \
pc += pc[-1]; \ pc += pc[-1]; \
goto rec##nn; \ goto rec##nn; \
case SAVE: \ case SAVE: \
save(nn, sub) \ newsub(sub) \
sub->sub[pc[1]] = _sp; \ sub->sub[pc[1]] = _sp; \
pc += 2; \ pc += 2; \
goto rec##nn; \ goto rec##nn; \
@@ -553,7 +553,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
gen = 1; gen = 1;
nsub->ref = 2; nsub->ref = 2;
save(0, nsub); newsub(nsub);
nsub->sub[0] = sp; nsub->sub[0] = sp;
goto jmp_start; goto jmp_start;
for(; clist->n; sp += l) { for(; clist->n; sp += l) {
@@ -586,7 +586,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
if (!matched) { if (!matched) {
nsub = lsub; nsub = lsub;
nsub->ref++; nsub->ref++;
save(3, nsub) newsub(nsub)
nsub->sub[0] = sp + l; nsub->sub[0] = sp + l;
swaplist() swaplist()
jmp_start: jmp_start: