jsonparse: Add basic JSON parser

Some TODO's left and this needs benchmarking.
This commit is contained in:
Yorhel 2025-01-31 07:16:46 +01:00
parent aebe5a93dc
commit 7cdc02e399
8 changed files with 508 additions and 21 deletions

View file

@ -7,9 +7,9 @@ typedef struct {
size_t maxlen;
} fustr;
static void fustr_init_(pTHX_ fustr *s, size_t prealloc, size_t maxlen) {
if (prealloc > maxlen) prealloc = maxlen;
s->sv = sv_2mortal(newSV(prealloc));
/* sv must be a new SV with a preallocated buffer */
static void fustr_init_(pTHX_ fustr *s, SV *sv, size_t maxlen) {
s->sv = sv;
SvPOK_only(s->sv);
s->cur = SvPVX(s->sv);
s->end = SvEND(s->sv);