diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2024-05-24 16:05:19 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2024-05-24 16:05:19 (GMT) |
| commit | b7eeffcdef4802086b4f43db1619b2784d74aa79 (patch) | |
| tree | 0e5d90abdf8a9e69a0fc4383d8ceac9d115a02c4 /generic/tclAlloc.c | |
| parent | 14145609e7b52c939ce5bc328b87b8ab02c7a431 (diff) | |
| parent | b230de2a4d3e8748a542c21d0dfde9e357ac0b0a (diff) | |
| download | tcl-b7eeffcdef4802086b4f43db1619b2784d74aa79.zip tcl-b7eeffcdef4802086b4f43db1619b2784d74aa79.tar.gz tcl-b7eeffcdef4802086b4f43db1619b2784d74aa79.tar.bz2 | |
Merge trunk
Diffstat (limited to 'generic/tclAlloc.c')
| -rw-r--r-- | generic/tclAlloc.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 3c4fac3..b52d1b3 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -47,17 +47,18 @@ typedef size_t caddr_t; */ union overhead { - union overhead *next; /* when free */ - unsigned char padding[TCL_ALLOCALIGN]; /* align struct to TCL_ALLOCALIGN bytes */ + union overhead *next; /* when free */ + unsigned char padding[TCL_ALLOCALIGN]; + /* align struct to TCL_ALLOCALIGN bytes */ struct { - unsigned char magic0; /* magic number */ - unsigned char index; /* bucket # */ - unsigned char unused; /* unused */ - unsigned char magic1; /* other magic number */ + unsigned char magic0; /* magic number */ + unsigned char index; /* bucket # */ + unsigned char unused; /* unused */ + unsigned char magic1; /* other magic number */ #ifndef NDEBUG - unsigned short rmagic; /* range magic number */ + unsigned short rmagic; /* range magic number */ size_t size; /* actual block size */ - unsigned short unused2; /* padding to 8-byte align */ + unsigned short unused2; /* padding to 8-byte align */ #endif } ovu; #define overMagic0 ovu.magic0 @@ -67,7 +68,6 @@ union overhead { #define realBlockSize ovu.size }; - #define MAGIC 0xEF /* magic # on accounting info */ #define RMAGIC 0x5555 /* magic # on range info */ @@ -92,7 +92,8 @@ union overhead { * precedes the data area returned to the user. */ -#define MINBLOCK ((sizeof(union overhead) + (TCL_ALLOCALIGN-1)) & ~(TCL_ALLOCALIGN-1)) +#define MINBLOCK \ + ((sizeof(union overhead) + (TCL_ALLOCALIGN-1)) & ~(TCL_ALLOCALIGN-1)) #define NBUCKETS (13 - (MINBLOCK >> 4)) #define MAXMALLOC ((size_t)1 << (NBUCKETS+2)) static union overhead *nextf[NBUCKETS]; @@ -251,7 +252,7 @@ TclFinalizeAllocSubsystem(void) void * TclpAlloc( - size_t numBytes) /* Number of bytes to allocate. */ + size_t numBytes) /* Number of bytes to allocate. */ { union overhead *overPtr; size_t bucket; @@ -385,10 +386,10 @@ TclpAlloc( static void MoreCore( - size_t bucket) /* What bucket to allocate to. */ + size_t bucket) /* What bucket to allocate to. */ { union overhead *overPtr; - size_t size; /* size of desired block */ + size_t size; /* size of desired block */ size_t amount; /* amount to allocate */ size_t numBlocks; /* how many blocks we get */ struct block *blockPtr; @@ -511,7 +512,7 @@ TclpFree( void * TclpRealloc( void *oldPtr, /* Pointer to alloc'ed block. */ - size_t numBytes) /* New size of memory. */ + size_t numBytes) /* New size of memory. */ { int i; union overhead *overPtr; @@ -743,7 +744,7 @@ TclpFree( void * TclpRealloc( void *oldPtr, /* Pointer to alloced block. */ - size_t numBytes) /* New size of memory. */ + size_t numBytes) /* New size of memory. */ { return realloc(oldPtr, numBytes); } |
