From e195d5379deb5699ea7cb76e4b3077a2cffa40da Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 26 Feb 2009 17:41:43 -0800 Subject: Since the stack has a fixed size, don't allocate dynamically. --- pbstream.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'pbstream.c') diff --git a/pbstream.c b/pbstream.c index 4ce8cc3..d5ddc1c 100644 --- a/pbstream.c +++ b/pbstream.c @@ -4,7 +4,6 @@ * Copyright (c) 2008-2009 Joshua Haberman. See LICENSE for details. */ -#include #include #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); -} -- cgit v1.2.3