From b99b79d8080cc1491f96069677d9ce0b7775a4f0 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 9 Sep 2026 23:02:20 +0200 Subject: chore: replace some naked pointers The coding guidelines explicitly prohibit the use of "naked"/C-style pointers. However, there were some prominent examples in the kapi and the core kernel source. This changeset replaces them with the appropriate smart pointer types. --- kernel/kapi/devices/device.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/kapi/devices/device.cpp') diff --git a/kernel/kapi/devices/device.cpp b/kernel/kapi/devices/device.cpp index 2576e20a..3a3b7cc1 100644 --- a/kernel/kapi/devices/device.cpp +++ b/kernel/kapi/devices/device.cpp @@ -23,12 +23,12 @@ namespace kapi::devices : m_name(name) {} - auto device::facet(kapi::capabilities::facet_id facet) noexcept -> void * + auto device::facet(kapi::capabilities::facet_id facet) noexcept -> kstd::observer_ptr { return query_facet(facet); } - auto device::facet(kapi::capabilities::facet_id facet) const noexcept -> void const * + auto device::facet(kapi::capabilities::facet_id facet) const noexcept -> kstd::observer_ptr { return const_cast(this)->query_facet(facet); } @@ -61,10 +61,10 @@ namespace kapi::devices m_state = state; } - auto device::bound_driver() const noexcept -> driver * + auto device::bound_driver() const noexcept -> kstd::shared_ptr { auto guard = kstd::lock_guard{m_lock}; - return m_driver.lock().get(); + return m_driver.lock(); } auto device::bind_driver(kstd::weak_ptr driver) -> void @@ -114,7 +114,7 @@ namespace kapi::devices m_resources = std::move(resources); } - auto device::query_facet(kapi::capabilities::facet_id) -> void * + auto device::query_facet(kapi::capabilities::facet_id) -> kstd::observer_ptr { return nullptr; } -- cgit v1.2.3