From ed1a4b76a38b1e6eb633c2b063dea43567be973f Mon Sep 17 00:00:00 2001 From: Xuefer Date: Thu, 19 Jul 2012 04:05:56 +0000 Subject: [PATCH] fix mem test git-svn-id: svn://svn.lighttpd.net/xcache/trunk@999 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- xcache/xc_mem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xcache/xc_mem.c b/xcache/xc_mem.c index 06be542..7619d83 100644 --- a/xcache/xc_mem.c +++ b/xcache/xc_mem.c @@ -338,22 +338,22 @@ int main() int count = 0; void *p; void *memory; + xc_mem_t *mem; void **ptrs; - xc_mem_t mem_holder, *mem = &mem_holder; int size, i; #if 0 fprintf(stderr, "%s", "Input test size: "); scanf("%d", &size); #else - size = 100; + size = 1024; #endif CHECK(memory = malloc(size), "OOM"); CHECK(ptrs = malloc(size * sizeof(void *)), "OOM"); - CHECK(mem = xc_mem_init(memory, mem, size), "Failed init memory allocator"); + mem = (xc_mem_t *) memory; + CHECK(mem = xc_mem_init(NULL, mem, size), "Failed init memory allocator"); while ((p = xc_mem_malloc(mem, 1))) { - fprintf(stderr, "%d %p\n", count, ptrs); ptrs[count ++] = p; } fprintf(stderr, "count=%d, random freeing\n", count);