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 /tests.c | |
parent | eaa0cdd6a162139406b24114aa6c5f27da3b1af0 (diff) |
Since the stack has a fixed size, don't allocate dynamically.
Diffstat (limited to 'tests.c')
-rw-r--r-- | tests.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,6 @@ #include <assert.h> #include <stdio.h> +#include <stdlib.h> #include "pbstream.c" void test_get_v_uint64_t() @@ -66,7 +67,6 @@ void test_simple_proto() assert(val.field == &fieldset1->fields[0]); assert(val.v.int32 == 150); assert(s.offset == 3); - pbstream_free_parser(&s); char message2[] = {0x12, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67}; pbstream_init_parser(&s, fieldset1); @@ -76,7 +76,6 @@ void test_simple_proto() assert(val.v.delimited.offset == 2); assert(val.v.delimited.len == 7); assert(s.offset == 9); - pbstream_free_parser(&s); struct pbstream_fieldset *fieldset2 = malloc(sizeof(*fieldset1) + sizeof(struct pbstream_field[3])); @@ -92,7 +91,7 @@ void test_simple_proto() assert(val.v.delimited.offset == 2); assert(val.v.delimited.len == 3); assert(s.offset == 2); - assert(s.top-1 == s.base); + assert(s.top-1 == s.stack); assert(s.top->fieldset == fieldset1); assert(s.top->end_offset == 5); @@ -105,8 +104,7 @@ void test_simple_proto() assert(pbstream_parse_field(&s, NULL /* shouldn't be read */, &fieldnum, &val, &wv) == PBSTREAM_STATUS_SUBMESSAGE_END); - assert(s.top == s.base); - pbstream_free_parser(&s); + assert(s.top == s.stack); free(fieldset1); free(fieldset2); |