summaryrefslogtreecommitdiff
path: root/rts/MBlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/MBlock.c')
-rw-r--r--rts/MBlock.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/rts/MBlock.c b/rts/MBlock.c
index 9058205716..edde679992 100644
--- a/rts/MBlock.c
+++ b/rts/MBlock.c
@@ -340,16 +340,16 @@ allocNew(nat n) {
sysErrorBelch(
"getMBlocks: VirtualAlloc MEM_RESERVE %d blocks failed", n);
} else {
- if(allocs==0) {
- allocs=rec;
- rec->next=0;
- } else {
- alloc_rec* it;
- it=allocs;
- for(; it->next!=0 && it->next->base<rec->base; it=it->next) ;
- rec->next=it->next;
- it->next=rec;
- }
+ alloc_rec temp;
+ temp.base=0; temp.size=0; temp.next=allocs;
+
+ alloc_rec* it;
+ it=&temp;
+ for(; it->next!=0 && it->next->base<rec->base; it=it->next) ;
+ rec->next=it->next;
+ it->next=rec;
+
+ allocs=temp.next;
debugTrace(DEBUG_gc, "allocated %d megablock(s) at 0x%x",n,(nat)rec->base);
}
return rec;