diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-02-26 17:41:43 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-02-26 17:41:43 -0800 |
commit | e195d5379deb5699ea7cb76e4b3077a2cffa40da (patch) | |
tree | f8cd081aa4943d3bef63969dda6628866963fdc5 /pbstream.c | |
parent | eaa0cdd6a162139406b24114aa6c5f27da3b1af0 (diff) |
Since the stack has a fixed size, don't allocate dynamically.
Diffstat (limited to 'pbstream.c')
-rw-r--r-- | pbstream.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -4,7 +4,6 @@ * Copyright (c) 2008-2009 Joshua Haberman. See LICENSE for details. */ -#include <stdlib.h> #include <string.h> #include "pbstream.h" @@ -292,14 +291,8 @@ void pbstream_init_parser( struct pbstream_fieldset *toplevel_fieldset) { state->offset = 0; - /* We match proto2's limit of 64 for maximum stack depth. */ - state->top = state->base = malloc(64*sizeof(*state->base)); - state->limit = state->base + 64; + state->top = state->stack; + state->limit = state->top + PBSTREAM_MAX_STACK; state->top->fieldset = toplevel_fieldset; state->top->end_offset = SIZE_MAX; } - -void pbstream_free_parser(struct pbstream_parse_state *state) -{ - free(state->base); -} |