Mercurial > hg > xemacs-beta
diff src/mc-alloc.c @ 2723:c474585a3460
[xemacs-hg @ 2005-04-10 00:47:53 by crestani]
New Allocator Fixes
* dumper.c (pdump_get_mc_addr): Use clearer code.
* dumper.c (pdump_put_mc_addr): Use clearer code.
* emacs.c (main_1): Initialize the new allocator only once.
* mc-alloc.c (get_page_header): Split up the assertions to better
spot the problem.
* mc-alloc.c (mc_alloc_1): Move definitions of local variables to
the beginning of the function.
author | crestani |
---|---|
date | Sun, 10 Apr 2005 00:47:58 +0000 |
parents | 6fa9919a9a0b |
children | 05d62157e048 |
line wrap: on
line diff
--- a/src/mc-alloc.c Sat Apr 09 21:51:59 2005 +0000 +++ b/src/mc-alloc.c Sun Apr 10 00:47:58 2005 +0000 @@ -571,11 +571,12 @@ { int l1_index = L1_INDEX (ptr); level_2_lookup_tree *l2 = PTR_LOOKUP_TABLE (l1_index); + assert (l2); #ifdef USE_HASH_TABLE while ((l2) && (LEVEL2_KEY (l2) != l1_index)) l2 = LEVEL2_HASH_LINK (l2); #endif - assert (l2 && LEVEL2 (l2, L2_INDEX (ptr))); + assert (LEVEL2 (l2, L2_INDEX (ptr))); return LEVEL2 (l2, L2_INDEX (ptr)); } @@ -1414,13 +1415,14 @@ mc_alloc_1 (size_t size, int managed) { page_list_header *plh = 0; + page_header *ph = 0; + void *result = 0; + if (managed) plh = USED_HEAP_PAGES (get_used_list_index (size)); else plh = UNMANAGED_HEAP_PAGES (get_unmanaged_list_index (size)); - page_header *ph = 0; - void *result = 0; if (size == 0) return 0; if (size < PAGE_SIZE_DIV_2)