Changeset 6a8ac0b for doc/generic_types/evaluation/c-stack.c
- Timestamp:
- Apr 25, 2017, 8:21:10 AM (6 years ago)
- Branches:
- 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:
- 89a9be2
- Parents:
- b3d70eba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/c-stack.c
rb3d70eba r6a8ac0b 11 11 void copy_stack(struct stack* s, const struct stack* t, void* (*copy)(const void*)) { 12 12 struct stack_node** crnt = &s->head; 13 struct stack_node* next = t->head; 14 while ( next ) { 13 for ( struct stack_node* next = t->head; next; next = next->next ) { 15 14 *crnt = malloc(sizeof(struct stack_node)); /***/ 16 15 **crnt = (struct stack_node){ copy(next->value) }; /***/ 17 16 crnt = &(*crnt)->next; 18 next = next->next;19 17 } 20 18 *crnt = 0; … … 22 20 23 21 void clear_stack(struct stack* s, void (*free_el)(void*)) { 24 struct stack_node* next = s->head; 25 while ( next ) { 22 for ( struct stack_node* next = s->head; next; ) { 26 23 struct stack_node* crnt = next; 27 24 next = crnt->next;
Note: See TracChangeset
for help on using the changeset viewer.