summaryrefslogtreecommitdiff
path: root/pbstream.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-02-26 17:41:43 -0800
committerJoshua Haberman <joshua@reverberate.org>2009-02-26 17:41:43 -0800
commite195d5379deb5699ea7cb76e4b3077a2cffa40da (patch)
treef8cd081aa4943d3bef63969dda6628866963fdc5 /pbstream.c
parenteaa0cdd6a162139406b24114aa6c5f27da3b1af0 (diff)
Since the stack has a fixed size, don't allocate dynamically.
Diffstat (limited to 'pbstream.c')
-rw-r--r--pbstream.c11
1 files changed, 2 insertions, 9 deletions
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 <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);
-}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback