Changeset 79d4186 for doc/papers/general/evaluation/cfa-stack.c
- Timestamp:
- Mar 6, 2018, 5:13:48 PM (5 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, 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:
- 14a3dad2
- Parents:
- 520145b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/cfa-stack.c
r520145b r79d4186 6 6 stack_node(T) * next; 7 7 }; 8 forall(otype T) void ?{}( stack_node(T) & node, T value, stack_node(T) * next ) {9 node.value = value;10 node.next = next;11 }12 8 13 9 forall(otype T) void ?{}( stack(T) & s ) { (s.head){ 0 }; } … … 16 12 stack_node(T) ** crnt = &s.head; 17 13 for ( stack_node(T) * next = t.head; next; next = next->next ) { 18 // *crnt = new( next->value, 0 ); 19 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 20 (*new_node){ next->value }; /***/ 14 stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/ 15 (*new_node){ next->value }; 21 16 *crnt = new_node; 22 stack_node(T) * acrnt = *crnt; 23 crnt = &acrnt->next; 17 crnt = &(*crnt)->next; 24 18 } 25 19 *crnt = 0; … … 38 32 39 33 forall(otype T) void push( stack(T) & s, T value ) { 40 // s.head = new( value, s.head ); 41 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 42 (*new_node){ value, s.head }; /***/ 34 stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/ 35 (*new_node){ value, s.head }; 43 36 s.head = new_node; 44 37 } … … 48 41 s.head = n->next; 49 42 T v = n->value; 50 delete( n ); 43 ^(*n){}; 44 free( n ); 51 45 return v; 52 46 } … … 56 50 stack_node(T) * crnt = next; 57 51 next = crnt->next; 58 delete( crnt ); 52 ^(*crnt){}; 53 free(crnt); 59 54 } 60 55 s.head = 0;
Note: See TracChangeset
for help on using the changeset viewer.