Loading src/list.c +12 −13 Changes for src/list.c: 12 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -18,19 +18,18 @@ int list_is_empty(list_t l){ list_t list_push(list_t l, void* x){ // add x to the end of l list_t new = malloc(sizeof(struct cell_t)); new->val = x; new->id = 0; new->next = NULL; if(l == NULL){ return new; } list_t tmp = l; while(tmp->next != NULL){ tmp = tmp->next; } tmp->next = new; return l; c -> val = x; if (list_is_empty(l)){ c -> id = 0; c -> next = NULL; return c; } else { c -> id = l -> id + 1; c -> next = l; return c; } } list_t list_tail(list_t l){ Loading Loading
src/list.c +12 −13 Changes for src/list.c: 12 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -18,19 +18,18 @@ int list_is_empty(list_t l){ list_t list_push(list_t l, void* x){ // add x to the end of l list_t new = malloc(sizeof(struct cell_t)); new->val = x; new->id = 0; new->next = NULL; if(l == NULL){ return new; } list_t tmp = l; while(tmp->next != NULL){ tmp = tmp->next; } tmp->next = new; return l; c -> val = x; if (list_is_empty(l)){ c -> id = 0; c -> next = NULL; return c; } else { c -> id = l -> id + 1; c -> next = l; return c; } } list_t list_tail(list_t l){ Loading