diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index 2413f37b..03e2be9c 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -102,7 +102,7 @@ namespace Scheduler if (old->is_idle()) { auto maybe_last = g_threads.last(); - if (maybe_last.has_error()) // No threads!! + if (!maybe_last.has_value()) // No threads!! return &g_idle; g_current = old = maybe_last.value(); } @@ -111,7 +111,7 @@ namespace Scheduler do { auto maybe_next = g_threads.next(g_current); - if (maybe_next.has_error()) g_current = g_threads.expect_first(); + if (!maybe_next.has_value()) g_current = g_threads.expect_first(); else g_current = maybe_next.value(); diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index 698e5a9a..47a07cbf 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -1,9 +1,9 @@ #pragma once -#include +#include -template inline Result nonnull_or_error(T* ptr) +template inline Option nonnull_or_error(T* ptr) { - if (ptr == nullptr) return err(ENONE); + if (ptr == nullptr) return {}; else return ptr; } @@ -101,7 +101,7 @@ template class DoublyLinkedList return ptr; } - Result first() + Option first() { return nonnull_or_error((T*)m_start_node); } @@ -111,7 +111,7 @@ template class DoublyLinkedList return first().value(); } - Result last() + Option last() { return nonnull_or_error((T*)m_end_node); } @@ -121,12 +121,12 @@ template class DoublyLinkedList return last().value(); } - Result next(T* item) + Option next(T* item) { return nonnull_or_error((T*)extract_node(item)->get_next()); } - Result previous(T* item) + Option previous(T* item) { return nonnull_or_error((T*)extract_node(item)->get_last()); }