Ignore:
Timestamp:
Apr 7, 2017, 2:32:03 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
3a48e283
Parents:
4cfcf41
Message:

Expand benchmarks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/c-stack.c

    r4cfcf41 r122aecd  
    99struct stack new_stack() {
    1010        return (struct stack){ NULL };
     11}
     12
     13void copy_stack(struct stack* s, struct stack* t, void* (*copy)(void*)) {
     14        struct stack_node** crnt = &s->head;
     15        struct stack_node* next = t->head;
     16        while ( next ) {
     17                *crnt = malloc(sizeof(struct stack_node));
     18                **crnt = (struct stack_node){ copy(next->value) };
     19                crnt = &(*crnt)->next;
     20                next = next->next;
     21        }
     22        *crnt = 0;
    1123}
    1224
Note: See TracChangeset for help on using the changeset viewer.