diff options
| -rw-r--r-- | list.c | 8 |
1 files changed, 3 insertions, 5 deletions
| @@ -33,17 +33,16 @@ list_add(struct list_item *next, T data) | |||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void | 35 | void |
| 36 | list_insert_next(struct list_item *node, T data) | 36 | list_insert_next(struct list_item *list, T data) |
| 37 | { | 37 | { |
| 38 | struct list_item *new_item; | 38 | struct list_item *new_item; |
| 39 | 39 | ||
| 40 | // TODO: Debuggen und nochmal richtig drüber nachdenken! | ||
| 41 | new_item = malloc(sizeof *new_item); | 40 | new_item = malloc(sizeof *new_item); |
| 42 | if ( new_item != NULL ) { | 41 | if ( new_item != NULL ) { |
| 43 | new_item->next = node->next; | ||
| 44 | new_item->data = data; | 42 | new_item->data = data; |
| 45 | 43 | ||
| 46 | node->next = new_item; | 44 | new_item->next = list->next; |
| 45 | list->next = new_item; | ||
| 47 | } | 46 | } |
| 48 | else | 47 | else |
| 49 | ERROR("out of memory"); | 48 | ERROR("out of memory"); |
| @@ -76,7 +75,6 @@ list_delete(struct list_item *list, T data) | |||
| 76 | void | 75 | void |
| 77 | list_delete_next(struct list_item *list) | 76 | list_delete_next(struct list_item *list) |
| 78 | { | 77 | { |
| 79 | // TODO: Debuggen und nochmal richtig drüber nachdenken! | ||
| 80 | if ( list->next != NULL ) { | 78 | if ( list->next != NULL ) { |
| 81 | struct list_item *temp = list->next; | 79 | struct list_item *temp = list->next; |
| 82 | 80 | ||
