Allocates space for a new list node, returning the pointer to it
| 22 | |
| 23 | // Allocates space for a new list node, returning the pointer to it |
| 24 | listnode *NewListNode(void) { |
| 25 | listnode *node; |
| 26 | |
| 27 | node = (listnode *)mem_malloc(sizeof(listnode)); |
| 28 | if (node == NULL) { |
| 29 | mprintf(0, "Not enough memory for a new listnode!\n"); |
| 30 | Int3(); |
| 31 | return NULL; |
| 32 | } |
| 33 | |
| 34 | node->data = NULL; |
| 35 | node->next = NULL; |
| 36 | node->prev = NULL; |
| 37 | |
| 38 | return node; |
| 39 | } |
| 40 | |
| 41 | // Adds an item to a list |
| 42 | // Returns 1 if everything is ok, else 0 |