Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r2b23d78 r0f89d4f  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 20 23:00:32 2020
    13 // Update Count     : 808
     12// Last Modified On : Wed May 27 15:08:49 2020
     13// Update Count     : 770
    1414//
    1515
     
    208208
    209209#if BUCKETLOCK == LOCKFREE
    210 static inline {
    211         Link(HeapManager.Storage) * ?`next( HeapManager.Storage * this ) { return &this->header.kind.real.next; }
    212         void ?{}( HeapManager.FreeHeader & ) {}
    213         void ^?{}( HeapManager.FreeHeader & ) {}
    214 } // distribution
     210static inline Link(HeapManager.Storage) * ?`next( HeapManager.Storage * this ) { return &this->header.kind.real.next; }
     211static inline void ?{}( HeapManager.FreeHeader & ) {}
     212static inline void ^?{}( HeapManager.FreeHeader & ) {}
    215213#endif // LOCKFREE
    216214
     
    901899          if ( oalign == 0 && size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size
    902900                        header->kind.real.blockSize &= -2;                      // no alignment and turn off 0 fill
    903                         if ( size != odsize ) header->kind.real.size = size; // reset allocation size
    904901                        return oaddr;
    905902                } // if
     
    930927
    931928                size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket
    932           if ( size <= odsize && odsize <= size * 2 ) {         // allow up to 50% wasted storage in smaller size
    933                         if ( size != odsize ) header->kind.real.size = size; // reset allocation size
     929          if ( size <= odsize && odsize <= size * 2 ) { // allow up to 50% wasted storage in smaller size
     930                        // Do not know size of original allocation => cannot do 0 fill for any additional space because do not know
     931                        // where to start filling, i.e., do not overwrite existing values in space.
    934932                        return oaddr;
    935933                } // if
     
    10981096        // Returns original total allocation size (not bucket size) => array size is dimension * sizeif(T).
    10991097        size_t malloc_size( void * addr ) {
    1100           if ( unlikely( addr == 0p ) ) return 0;                       // null allocation has zero size
     1098          if ( unlikely( addr == 0p ) ) return false;           // null allocation is not zero fill
    11011099                HeapManager.Storage.Header * header = headerAddr( addr );
    11021100                if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ?
     
    11081106        // Set allocation size and return previous size.
    11091107        size_t $malloc_size_set( void * addr, size_t size ) {
    1110           if ( unlikely( addr == 0p ) ) return 0;                       // null allocation has 0 size
     1108          if ( unlikely( addr == 0p ) ) return false;           // null allocation is not zero fill
    11111109                HeapManager.Storage.Header * header = headerAddr( addr );
    11121110                if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ?
     
    12271225                if ( size <= odsize && odsize <= size * 2 ) {   // allow 50% wasted storage for smaller size
    12281226                        header->kind.real.blockSize &= -2;                      // turn off 0 fill
    1229                         if ( size != odsize ) header->kind.real.size = size; // reset allocation size
    12301227                        return oaddr;
    12311228                } // if
Note: See TracChangeset for help on using the changeset viewer.