Changes in src/tests/init_once.c [2afec66:72e9222]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/init_once.c
r2afec66 r72e9222 60 60 return -1; 61 61 } 62 void ?{}(array &arr) {63 memset(arr .elems, 0, sizeof(arr.elems));64 arr .length = 0;62 void ?{}(array * arr) { 63 memset(arr->elems, 0, sizeof(arr->elems)); 64 arr->length = 0; 65 65 } 66 66 array constructed; 67 67 array destructed; 68 68 69 void ?{}(init_once &x) {70 assert( find( &constructed, &x ) == -1 );71 remove( &destructed, &x );72 insert( &constructed, &x );69 void ?{}(init_once * x) { 70 assert( find( &constructed, x ) == -1 ); 71 remove( &destructed, x ); 72 insert( &constructed, x ); 73 73 74 x .x = malloc(sizeof(int));74 x->x = malloc(sizeof(int)); 75 75 } 76 76 77 void ?{}(init_once &x, init_once other) {77 void ?{}(init_once * x, init_once other) { 78 78 x{}; // reuse default ctor 79 79 } 80 80 81 void ^?{}(init_once &x) {82 assert( find( &destructed, &x ) == -1 );83 remove( &constructed, &x );84 insert( &destructed, &x );81 void ^?{}(init_once * x) { 82 assert( find( &destructed, x ) == -1 ); 83 remove( &constructed, x ); 84 insert( &destructed, x ); 85 85 86 free(x .x);86 free(x->x); 87 87 } 88 88 //*** end setup … … 125 125 init_once x; 126 126 init_once y = x; 127 x{}; // ensure this doesn't execute127 (&x) {}; // ensure this doesn't execute 128 128 break; 129 129 }
Note:
See TracChangeset
for help on using the changeset viewer.