Changeset a1574e2 for libcfa/src


Ignore:
Timestamp:
Nov 3, 2021, 11:47:55 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
ab4a595
Parents:
7dd98b6
Message:

Forgot this was needed for the non-VLA commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/monitor.hfa

    r7dd98b6 ra1574e2  
    6565        free( th );
    6666}
     67
     68static inline forall( T & | sized(T) | { void ^?{}( T & mutex ); } )
     69void adelete( T arr[] ) {
     70        if ( arr ) {                                                                            // ignore null
     71                size_t dim = malloc_size( arr ) / sizeof( T );
     72                for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     73                        ^(arr[i]){};                                                            // run destructor
     74                } // for
     75                free( arr );
     76        } // if
     77} // adelete
    6778
    6879//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.