Ignore:
Timestamp:
May 27, 2020, 3:14:50 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:
a491a3c
Parents:
c19bc90
Message:

create heap.hfa, use it in malloc.h, and cleanup includes with respect to extern "C"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    rc19bc90 rada0246d  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 13 17:23:51 2020
    13 // Update Count     : 435
     12// Last Modified On : Tue May 26 22:50:08 2020
     13// Update Count     : 439
    1414//
    1515
     
    1919#include "bits/align.hfa"
    2020
     21#include <malloc.h>
    2122#include <stdlib.h>                                                                             // *alloc, strto*, ato*
    2223
    2324// Reduce includes by explicitly defining these routines.
    2425extern "C" {
    25         void * aalloc( size_t dim, size_t elemSize );           // CFA heap
    26         void * resize( void * oaddr, size_t size );                     // CFA heap
    27         void * memalign( size_t align, size_t size );           // malloc.h
    28         void * amemalign( size_t align, size_t dim, size_t elemSize ); // CFA heap
    29         void * cmemalign( size_t align, size_t noOfElems, size_t elemSize ); // CFA heap
    30         size_t malloc_size( void * addr );                                      // CFA heap
    31         size_t malloc_usable_size( void * ptr );                        // malloc.h
    3226        void * memset( void * dest, int fill, size_t size ); // string.h
    3327        void * memcpy( void * dest, const void * src, size_t size ); // string.h
    3428} // extern "C"
    35 
    36 void * resize( void * oaddr, size_t nalign, size_t size ); // CFA heap
    37 void * realloc( void * oaddr, size_t nalign, size_t size ); // CFA heap
    3829
    3930//---------------------------------------
     
    9182                return posix_memalign( (void **)ptr, align, sizeof(T) ); // C posix_memalign
    9283        } // posix_memalign
     84
     85        T * valloc( void ) {
     86                return (T *)valloc( sizeof(T) );                                // C valloc
     87        } // valloc
     88
     89        T * pvalloc( void ) {
     90                return (T *)pvalloc( sizeof(T) );                               // C pvalloc
     91        } // pvalloc
    9392} // distribution
    9493
Note: See TracChangeset for help on using the changeset viewer.