Changeset 1f6de372


Ignore:
Timestamp:
Dec 3, 2019, 5:39:07 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
1d60da8
Parents:
1805b1b
Message:

change realloc to return 0-sized storage for size 0 rather than NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r1805b1b r1f6de372  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 29 17:33:58 2019
    13 // Update Count     : 641
     12// Last Modified On : Tue Dec  3 13:58:44 2019
     13// Update Count     : 642
    1414//
    1515
     
    855855                #endif // __STATISTICS__
    856856
    857           if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases
     857                // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
     858          if ( unlikely( size == 0 ) ) { free( oaddr ); return mallocNoStats( size ); } // special cases
    858859          if ( unlikely( oaddr == 0p ) ) return mallocNoStats( size );
    859860
     
    10821083        #endif // __STATISTICS__
    10831084
    1084   if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases
     1085        // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
     1086  if ( unlikely( size == 0 ) ) { free( oaddr ); return mallocNoStats( size ); } // special cases
    10851087  if ( unlikely( oaddr == 0p ) ) return mallocNoStats( size );
    10861088
Note: See TracChangeset for help on using the changeset viewer.