Use constructor attribute with initialize().

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2006 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1997-01-06 21:38:10 +00:00
parent f6a5d7b97f
commit 1f69623c87

View file

@ -122,13 +122,13 @@ static NSZone defaultZone;
static ZoneTable *zones = NULL;
static ZoneTable *endzones = NULL;
static void initialize(void);
/* Gets a block with size SIZE. SIZE must be a multiple of bsize. The
size given includes overhead. Returns NULL if no block can be
returned. */
static BlockHeader *getBlock(unsigned size);
static void initialize(void) __attribute((constructor));
static void releaseBlock(BlockHeader *block);
static void *getMemInBlock(BlockHeader *block, unsigned size);
static void insertFreeChunk(BlockHeader *block, void *chunk);
@ -356,9 +356,6 @@ NSCreateZone(unsigned startSize, unsigned granularity, BOOL canFree)
NSZone *zone;
BlockHeader *block;
if (!bsize)
/* FIXME: Any way to make sure this runs only once? */
initialize();
if ((startSize == 0) || (startSize > maxsblock()))
startSize = bsize;
else
@ -406,9 +403,6 @@ NSCreateZone(unsigned startSize, unsigned granularity, BOOL canFree)
NSZone*
NSDefaultMallocZone(void)
{
if (!bsize)
/* FIXME: Any way to make sure this runs only once? */
initialize();
return &defaultZone;
}
@ -521,7 +515,7 @@ static void
initialize(void)
{
BlockHeader *block;
bsize = NSPageSize();
zunit = (bsize-sizeof(ZoneTable))/sizeof(NSZone);
zonelock = makelock();