Add unit test for memory layout based off the Kenton's layout-test.c++ and whole slew of fixes to get the test to pass

This commit is contained in:
James McKaskill 2013-05-07 11:04:49 -04:00
parent 12d72511b1
commit 3a235fe8c6
7 changed files with 824 additions and 273 deletions

View file

@ -11,8 +11,7 @@ static struct capn_segment *create(void *u, uint32_t id, int sz) {
sz = (sz + 4095) & ~4095;
}
s = (struct capn_segment*) calloc(1, sizeof(*s));
s->data = calloc(1, sz);
s->len = 0;
s->data = (char*) calloc(1, sz);
s->cap = sz;
return s;
}
@ -22,7 +21,7 @@ void capn_init_malloc(struct capn *c) {
c->create = &create;
}
void capn_free_all(struct capn *c) {
void capn_free_malloc(struct capn *c) {
struct capn_segment *s = c->seglist;
while (s != NULL) {
struct capn_segment *n = s->next;