From f547b276d59dc02002baa1c09fb2e5e02f3bdda9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 8 May 2005 10:58:26 +0000 Subject: [PATCH] *** empty log message *** --- ase/stx/memory.c | 10 +++++++++- ase/test/stx/stx.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ase/stx/memory.c b/ase/stx/memory.c index 22edd6a1..220d31cb 100644 --- a/ase/stx/memory.c +++ b/ase/stx/memory.c @@ -1,5 +1,5 @@ /* - * $Id: memory.c,v 1.5 2005-05-08 10:31:24 bacon Exp $ + * $Id: memory.c,v 1.6 2005-05-08 10:58:26 bacon Exp $ */ #include @@ -10,6 +10,7 @@ xp_stx_memory_t* xp_stx_memory_open ( xp_stx_memory_t* mem, xp_stx_word_t capacity) { xp_stx_object_t** slots; + xp_stx_word_t n; xp_assert (capacity > 0); if (mem == XP_NULL) { @@ -30,12 +31,19 @@ xp_stx_memory_t* xp_stx_memory_open ( mem->slots = slots; /* weave the free slot list */ + /* mem->free = &slots[capacity - 1]; while (capacity > 1) { capacity--; mem->slots[capacity] = (xp_stx_object_t*)&mem->slots[capacity - 1]; } mem->slots[--capacity] = XP_NULL; + */ + mem->free = &slots[0]; + for (n = 0; n < capacity - 1; n++) { + mem->slots[n] = (xp_stx_object_t*)&mem->slots[n + 1]; + } + mem->slots[n + 1] = XP_NULL; return mem; } diff --git a/ase/test/stx/stx.c b/ase/test/stx/stx.c index a8e58e8f..0414663c 100644 --- a/ase/test/stx/stx.c +++ b/ase/test/stx/stx.c @@ -26,7 +26,7 @@ int xp_main () i, xp_stx_memory_alloc(&stx.memory, 100)); } - for (i = 0; i < 5; i++) { + for (i = 5; i < 10; i++) { xp_stx_memory_dealloc (&stx.memory, i); }