Ignore:
Timestamp:
Jul 12, 2017, 4:40:02 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0698aa1
Parents:
469f709
Message:

Convert several library files to use references

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib.c

    r469f709 raca65621  
    3434        if ( nlen > olen ) {                                                            // larger ?
    3535                memset( nptr + olen, (int)fill, nlen - olen );  // initialize added storage
    36         } // 
     36        } //
    3737    return (T *)nptr;
    3838} // alloc
    3939
    4040// allocation/deallocation and constructor/destructor, non-array types
    41 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
     41forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
    4242T * new( Params p ) {
    4343        return (malloc()){ p };                                                         // run constructor
    4444} // new
    4545
    46 forall( dtype T | { void ^?{}( T * ); } )
     46forall( dtype T | { void ^?{}( T & ); } )
    4747void delete( T * ptr ) {
    4848        if ( ptr ) {                                                                            // ignore null
     
    5252} // delete
    5353
    54 forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } )
     54forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } )
    5555void delete( T * ptr, Params rest ) {
    5656        if ( ptr ) {                                                                            // ignore null
     
    6363
    6464// allocation/deallocation and constructor/destructor, array types
    65 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
     65forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
    6666T * anew( size_t dim, Params p ) {
    6767        T *arr = alloc( dim );
     
    7272} // anew
    7373
    74 forall( dtype T | sized(T) | { void ^?{}( T * ); } )
     74forall( dtype T | sized(T) | { void ^?{}( T & ); } )
    7575void adelete( size_t dim, T arr[] ) {
    7676        if ( arr ) {                                                                            // ignore null
     
    8282} // adelete
    8383
    84 forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } )
     84forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } )
    8585void adelete( size_t dim, T arr[], Params rest ) {
    8686        if ( arr ) {                                                                            // ignore null
Note: See TracChangeset for help on using the changeset viewer.