Changeset 61248a4


Ignore:
Timestamp:
Apr 20, 2020, 3:01:34 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a3fab47, e045590
Parents:
66f3bae
Message:

update comments for public C allocation routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r66f3bae r61248a4  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr 18 08:17:53 2020
    13 // Update Count     : 716
     12// Last Modified On : Sat Apr 18 17:43:15 2020
     13// Update Count     : 718
    1414//
    1515
     
    844844
    845845extern "C" {
    846         // Allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0,
    847         // then malloc() returns either 0p, or a unique pointer value that can later be successfully passed to free().
     846        // Allocates size bytes and returns a pointer to the allocated memory.  The contents are undefined. If size is 0,
     847        // then malloc() returns a unique pointer value that can later be successfully passed to free().
    848848        void * malloc( size_t size ) {
    849849                #ifdef __STATISTICS__
     
    856856
    857857
    858         // Allocate memory for an array of dim elements of size bytes each and returns a pointer to the allocated memory. If
    859         // dim or size is 0, then calloc() returns either 0p, or a unique pointer value that can later be successfully
    860         // passed to free().
     858        // Same as malloc() except size bytes is an array of dim elements each of elemSize bytes.
    861859        void * aalloc( size_t dim, size_t elemSize ) {
    862860                #ifdef __STATISTICS__
     
    879877
    880878
    881         // Same as aalloc() with memory is set to zero.
     879        // Same as aalloc() with memory set to zero.
    882880        void * calloc( size_t dim, size_t elemSize ) {
    883881                #ifdef __STATISTICS__
     
    889887        } // calloc
    890888
    891         // Change the size of the memory block pointed to by ptr to size bytes. The contents are undefined.  If ptr is 0p,
    892         // then the call is equivalent to malloc(size), for all values of size; if size is equal to zero, and ptr is not 0p,
    893         // then the call is equivalent to free(ptr). Unless ptr is 0p, it must have been returned by an earlier call to
    894         // malloc(), calloc() or realloc(). If the area pointed to was moved, a free(ptr) is done.
    895 
     889        // Change the size of the memory block pointed to by oaddr to size bytes. The contents are undefined.  If oaddr is
     890        // 0p, then the call is equivalent to malloc(size), for all values of size; if size is equal to zero, and oaddr is
     891        // not 0p, then the call is equivalent to free(oaddr). Unless oaddr is 0p, it must have been returned by an earlier
     892        // call to malloc(), alloc(), calloc() or realloc(). If the area pointed to was moved, a free(oaddr) is done.
    896893        void * resize( void * oaddr, size_t size ) {
    897894                #ifdef __STATISTICS__
     
    923920
    924921
    925         // Same as resize but the contents shall be unchanged in the range from the start of the region up to the minimum of
     922        // Same as resize() but the contents are unchanged in the range from the start of the region up to the minimum of
    926923        // the old and new sizes.
    927924        void * realloc( void * oaddr, size_t size ) {
     
    973970        } // realloc
    974971
    975         // Allocates size bytes and returns a pointer to the allocated memory. The memory address shall be a multiple of
    976         // alignment, which must be a power of two. (obsolete)
     972        // Same as malloc() except the memory address is a multiple of alignment, which must be a power of two. (obsolete)
    977973        void * memalign( size_t alignment, size_t size ) {
    978974                #ifdef __STATISTICS__
Note: See TracChangeset for help on using the changeset viewer.