Changeset aca65621 for src/libcfa/stdlib.c
- Timestamp:
- Jul 12, 2017, 4:40:02 PM (8 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib.c
r469f709 raca65621 34 34 if ( nlen > olen ) { // larger ? 35 35 memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage 36 } // 36 } // 37 37 return (T *)nptr; 38 38 } // alloc 39 39 40 40 // allocation/deallocation and constructor/destructor, non-array types 41 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )41 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) 42 42 T * new( Params p ) { 43 43 return (malloc()){ p }; // run constructor 44 44 } // new 45 45 46 forall( dtype T | { void ^?{}( T *); } )46 forall( dtype T | { void ^?{}( T & ); } ) 47 47 void delete( T * ptr ) { 48 48 if ( ptr ) { // ignore null … … 52 52 } // delete 53 53 54 forall( dtype T, ttype Params | { void ^?{}( T *); void delete( Params ); } )54 forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } ) 55 55 void delete( T * ptr, Params rest ) { 56 56 if ( ptr ) { // ignore null … … 63 63 64 64 // allocation/deallocation and constructor/destructor, array types 65 forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )65 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) 66 66 T * anew( size_t dim, Params p ) { 67 67 T *arr = alloc( dim ); … … 72 72 } // anew 73 73 74 forall( dtype T | sized(T) | { void ^?{}( T *); } )74 forall( dtype T | sized(T) | { void ^?{}( T & ); } ) 75 75 void adelete( size_t dim, T arr[] ) { 76 76 if ( arr ) { // ignore null … … 82 82 } // adelete 83 83 84 forall( dtype T | sized(T) | { void ^?{}( T *); }, ttype Params | { void adelete( Params ); } )84 forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } ) 85 85 void adelete( size_t dim, T arr[], Params rest ) { 86 86 if ( arr ) { // ignore null
Note: See TracChangeset
for help on using the changeset viewer.