shithub: mc

Download patch

ref: bec29fb78c83ad0fd51a22bf1fda6306a8f3934b
parent: a6d583daf31a227466dbcb7dffb0f20c809c8821
author: Ori Bernstein <[email protected]>
date: Wed Jul 25 10:32:43 EDT 2012

Pretty up the source a bit.

--- a/alloc.myr
+++ b/alloc.myr
@@ -14,11 +14,15 @@
 const Zbyte	= 0 castto(byte*)
 const Zslab	= 0 castto(slab*)
 const Zchunk	= 0 castto(chunk*)
+
 const Pagesz 	= 4096	/* on the systems this supports, anyways... */
 const Cachemax	= 16	/* maximum number of slabs in the cache */
 const Bucketmax	= 1024	/* Pagesz / 8; a balance. */
 const Align	= 16	/* minimum allocation alignment */
 
+var buckets	: bucket[32] /* excessive */
+var initdone	: int
+
 type bucket = struct
 	sz	: size	/* aligned size */
 	nper	: size	/* max number of elements per slab */
@@ -36,9 +40,6 @@
 type chunk = struct	/* NB: must be smaller than sizeof(slab) */
 	next	: chunk*	/* the next chunk in the free list */
 ;;
-
-var buckets : bucket[32] /* excessive */
-var initdone : int
 
 generic alloc = {-> @a*
 	-> bytealloc(sizeof(@a)) castto(@a*)