diff --git a/pikevm.h b/pikevm.h index e9d6d5e..25118c9 100644 --- a/pikevm.h +++ b/pikevm.h @@ -582,7 +582,7 @@ static int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp) rthread *clist = _clist, *nlist = _nlist, *tmp; int rsubsize = prog->presub, suboff = 0; int cnt, spc, i, c, osubp = nsubp * sizeof(char*); - int si = 0, clistidx = 0, nlistidx, mcont = MATCH; + int si = 0, clistidx = 0, nlistidx, mcont = MATCH, len = -1; unsigned int sdense[prog->sparsesz], sparsesz = 0; char nsubs[prog->sub]; goto jmp_start; @@ -613,6 +613,7 @@ static int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp) matched: nlist[nlistidx++].pc = &mcont; if (npc != &mcont) { + len = sp-s; if (matched) decref(matched) matched = nsub; @@ -622,7 +623,7 @@ static int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp) subp[i] = matched->sub[i >> 1]; subp[i+1] = matched->sub[(nsubp >> 1) + (i >> 1)]; } - return 1; + return len; } swaplist() goto _continue;