don't pre-allocate all space when parsing an h_length_value
This commit is contained in:
parent
d2ade1f5b4
commit
3765fd64e1
1 changed files with 4 additions and 1 deletions
|
|
@ -10,7 +10,10 @@ typedef struct {
|
|||
|
||||
static HParseResult *parse_many(void* env, HParseState *state) {
|
||||
HRepeat *env_ = (HRepeat*) env;
|
||||
HCountedArray *seq = h_carray_new_sized(state->arena, (env_->count > 0 ? env_->count : 4));
|
||||
size_t size = env_->count;
|
||||
if(size <= 0) size = 4;
|
||||
if(size > 1024) size = 1024; // let's try parsing some elements first...
|
||||
HCountedArray *seq = h_carray_new_sized(state->arena, size);
|
||||
size_t count = 0;
|
||||
HInputStream bak;
|
||||
while (env_->min_p || env_->count > count) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue