Loading src/list.c +6 −9 Changes for src/list.c: 6 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -20,17 +20,14 @@ list_t list_push(list_t l, void* x){ // add x to the end of l struct cell_t* c = malloc(sizeof(struct cell_t)); c->val = x; c->id = 0; c->next = NULL; if(l == NULL){ return c; } struct cell_t* cur = l; while(cur->next != NULL){ cur = cur->next; c -> id = 1; c -> next = NULL; } else { c -> id = l -> id + 1; c -> next = l; } cur->next = c; return l; return c; } list_t list_tail(list_t l){ Loading Loading
src/list.c +6 −9 Changes for src/list.c: 6 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -20,17 +20,14 @@ list_t list_push(list_t l, void* x){ // add x to the end of l struct cell_t* c = malloc(sizeof(struct cell_t)); c->val = x; c->id = 0; c->next = NULL; if(l == NULL){ return c; } struct cell_t* cur = l; while(cur->next != NULL){ cur = cur->next; c -> id = 1; c -> next = NULL; } else { c -> id = l -> id + 1; c -> next = l; } cur->next = c; return l; return c; } list_t list_tail(list_t l){ Loading