diff options
| author | Thomas Schmucker <ts@its1.de> | 2022-03-12 10:17:25 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2022-03-12 10:17:25 +0100 |
| commit | 6a06c7048ef256796a1536aa50961896a54c2c7b (patch) | |
| tree | fea87e427d709790240a42f0091b9df45ab24de7 | |
| parent | 011ef70f4c1b6ef8384a3573d93595b42dba4395 (diff) | |
| download | data-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.tar.gz data-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.tar.bz2 data-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.zip | |
use list_add()
| -rw-r--r-- | list.c | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -43,11 +43,9 @@ list_insert_next(struct list_item *list, T data) | |||
| 43 | { | 43 | { |
| 44 | struct list_item *new_item; | 44 | struct list_item *new_item; |
| 45 | 45 | ||
| 46 | new_item = malloc(sizeof *new_item); | 46 | new_item = list_add(list->next, data); |
| 47 | if ( new_item ) { | 47 | if ( new_item ) { |
| 48 | new_item->data = data; | 48 | list->next = new_item; |
| 49 | new_item->next = list->next; | ||
| 50 | list->next = new_item; | ||
| 51 | } | 49 | } |
| 52 | else { | 50 | else { |
| 53 | ERROR("out of memory"); | 51 | ERROR("out of memory"); |
