From 728b72bc91ef123031e8bc68b10e498856e9bc57 Mon Sep 17 00:00:00 2001 From: PedroEdiaz Date: Sat, 24 Jan 2026 07:37:23 -0600 Subject: [PATCH] pikevm return how much it consumes --- pikevm.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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;