Changeset bf76eab for src/libcfa


Ignore:
Timestamp:
Feb 23, 2017, 2:13:28 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
3fddc6b
Parents:
9d169f1
Message:

add variadic delete to stdlib

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib

    r9d169f1 rbf76eab  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul  6 14:28:55 2016
    13 // Update Count     : 99
     12// Last Modified On : Thu Feb 23 14:11:47 2017
     13// Update Count     : 100
    1414//
    1515
     
    5050forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
    5151forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
    52 
     52forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) void delete( T * ptr, Params rest );
    5353
    5454//---------------------------------------
  • src/libcfa/stdlib.c

    r9d169f1 rbf76eab  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul  6 14:28:57 2016
    13 // Update Count     : 169
     12// Last Modified On : Thu Feb 23 14:11:29 2017
     13// Update Count     : 170
    1414//
    1515
     
    9191}
    9292
     93forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } )
     94void delete( T * ptr, Params rest ) {
     95        if ( ptr ) {
     96                ^ptr{};
     97                free( ptr );
     98        }
     99        delete( rest );
     100}
     101
    93102//---------------------------------------
    94103
Note: See TracChangeset for help on using the changeset viewer.