Skip to content
Myr

Pre-allocate tokenbuf for string parser (#3485)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #3483

authored by Fabian Fleischer · committed by GitHub · parent 061fd14 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:src/jv_parse.c+3 added-2 removed
77 unmodified lines
78 p->stacklen = p->stackpos = 0;79 p->last_seen = JV_LAST_NONE;80 p->output = jv_invalid();81 p->next = jv_invalid();82 p->tokenbuf = 0;83 p->tokenlen = p->tokenpos = 0;82 p->tokenlen = 256;83 p->tokenbuf = jv_mem_alloc(p->tokenlen);84 p->tokenpos = 0;85 if ((p->flags & JV_PARSE_SEQ))86 p->st = JV_PARSER_WAITING_FOR_RS;87 else88 p->st = JV_PARSER_NORMAL;
826 unmodified lines