aboutsummaryrefslogtreecommitdiff
path: root/libc/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/list.c')
-rw-r--r--libc/list.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libc/list.c b/libc/list.c
index c36d6e1..89de4d0 100644
--- a/libc/list.c
+++ b/libc/list.c
@@ -23,14 +23,14 @@ struct node *list_new_node()
return node;
}
-void list_add_node(struct list *list, struct node *node)
+struct node *list_add_node(struct list *list, struct node *node)
{
if (list == NULL)
- return;
+ return NULL;
if (list->head == NULL) {
list->head = node;
- return;
+ return list->head;
}
struct node *iterator = list->head;
@@ -42,13 +42,14 @@ void list_add_node(struct list *list, struct node *node)
}
iterator = iterator->next;
}
+ return node;
}
-void list_add(struct list *list, void *data)
+struct node *list_add(struct list *list, void *data)
{
struct node *node = list_new_node();
node->data = data;
- list_add_node(list, node);
+ return list_add_node(list, node);
}
// Maybe list_remove_node?