summaryrefslogtreecommitdiff
path: root/kernel/list.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-03-27 11:39:12 -0400
committerFreya Murphy <freya@freyacat.org>2025-03-27 11:39:12 -0400
commit0ff301cda68669c59351e5854ce98f2cf460543f (patch)
treecfe8f976261962420ada64b821559b9da0a56841 /kernel/list.c
parentadd compile_flags.txt for clangd lsp (diff)
downloadcomus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.gz
comus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.bz2
comus-0ff301cda68669c59351e5854ce98f2cf460543f.zip
pull upstream changes, add auto formatting
Diffstat (limited to '')
-rw-r--r--kernel/list.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/kernel/list.c b/kernel/list.c
index 084000a..5492615 100644
--- a/kernel/list.c
+++ b/kernel/list.c
@@ -29,11 +29,11 @@
** @param[in,out] list The address of a list_t variable
** @param[in] data The data to prepend to the list
*/
-void list_add( list_t *list, void *data ) {
-
+void list_add(list_t *list, void *data)
+{
// sanity checks
- assert1( list != NULL );
- assert1( data != NULL );
+ assert1(list != NULL);
+ assert1(data != NULL);
list_t *tmp = (list_t *)data;
tmp->next = list->next;
@@ -49,16 +49,15 @@ void list_add( list_t *list, void *data ) {
**
** @return a pointer to the removed data, or NULL if the list was empty
*/
-void *list_remove( list_t *list ) {
-
- assert1( list != NULL );
+void *list_remove(list_t *list)
+{
+ assert1(list != NULL);
list_t *data = list->next;
- if( data != NULL ) {
+ if (data != NULL) {
list->next = data->next;
data->next = NULL;
}
return (void *)data;
}
-