mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-23 13:57:04 +00:00
Kernel: Remove redundant [[nodiscard]] on KResult return values
Both KResult and KResultOr are [[nodiscard]] at the class level, so there's no need to have functions return `[[nodiscard]] KResult`.
This commit is contained in:
@@ -141,7 +141,7 @@ public:
|
||||
return m_error;
|
||||
}
|
||||
|
||||
[[nodiscard]] KResult result() const { return m_is_error ? m_error : KSuccess; }
|
||||
KResult result() const { return m_is_error ? m_error : KSuccess; }
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE T& value() &
|
||||
{
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
return released_value;
|
||||
}
|
||||
|
||||
[[nodiscard]] KResult release_error()
|
||||
KResult release_error()
|
||||
{
|
||||
VERIFY(m_is_error);
|
||||
return m_error;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
static KResultOr<NonnullOwnPtr<Coredump>> try_create(NonnullRefPtr<Process>, StringView output_path);
|
||||
|
||||
~Coredump() = default;
|
||||
[[nodiscard]] KResult write();
|
||||
KResult write();
|
||||
|
||||
private:
|
||||
Coredump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>);
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
template<size_t BUFFER_BYTES, typename... Args>
|
||||
[[nodiscard]] KResultOr<size_t> write_to_buffer_buffered(UserOrKernelBuffer& buffer, Args... args)
|
||||
KResultOr<size_t> write_to_buffer_buffered(UserOrKernelBuffer& buffer, Args... args)
|
||||
{
|
||||
if (in_target_context(buffer))
|
||||
return buffer.write_buffered<BUFFER_BYTES>(forward<Args>(args)...);
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
}
|
||||
|
||||
template<size_t BUFFER_BYTES, typename... Args>
|
||||
[[nodiscard]] KResultOr<size_t> read_from_buffer_buffered(const UserOrKernelBuffer& buffer, Args... args)
|
||||
KResultOr<size_t> read_from_buffer_buffered(const UserOrKernelBuffer& buffer, Args... args)
|
||||
{
|
||||
if (in_target_context(buffer))
|
||||
return buffer.read_buffered<BUFFER_BYTES>(forward<Args>(args)...);
|
||||
|
||||
@@ -17,19 +17,19 @@ namespace Kernel {
|
||||
class DoubleBuffer {
|
||||
public:
|
||||
[[nodiscard]] static OwnPtr<DoubleBuffer> try_create(size_t capacity = 65536);
|
||||
[[nodiscard]] KResultOr<size_t> write(const UserOrKernelBuffer&, size_t);
|
||||
[[nodiscard]] KResultOr<size_t> write(const u8* data, size_t size)
|
||||
KResultOr<size_t> write(const UserOrKernelBuffer&, size_t);
|
||||
KResultOr<size_t> write(const u8* data, size_t size)
|
||||
{
|
||||
return write(UserOrKernelBuffer::for_kernel_buffer(const_cast<u8*>(data)), size);
|
||||
}
|
||||
[[nodiscard]] KResultOr<size_t> read(UserOrKernelBuffer&, size_t);
|
||||
[[nodiscard]] KResultOr<size_t> read(u8* data, size_t size)
|
||||
KResultOr<size_t> read(UserOrKernelBuffer&, size_t);
|
||||
KResultOr<size_t> read(u8* data, size_t size)
|
||||
{
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
|
||||
return read(buffer, size);
|
||||
}
|
||||
[[nodiscard]] KResultOr<size_t> peek(UserOrKernelBuffer&, size_t);
|
||||
[[nodiscard]] KResultOr<size_t> peek(u8* data, size_t size)
|
||||
KResultOr<size_t> peek(UserOrKernelBuffer&, size_t);
|
||||
KResultOr<size_t> peek(u8* data, size_t size)
|
||||
{
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
|
||||
return peek(buffer, size);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void operator delete(void*);
|
||||
|
||||
[[nodiscard]] KResultOr<NonnullOwnPtr<KString>> try_clone() const;
|
||||
KResultOr<NonnullOwnPtr<KString>> try_clone() const;
|
||||
|
||||
[[nodiscard]] bool is_empty() const { return m_length == 0; }
|
||||
[[nodiscard]] size_t length() const { return m_length; }
|
||||
|
||||
@@ -193,7 +193,7 @@ KResult copy_from_user(void* dest_ptr, void const* src_ptr, size_t n)
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
[[nodiscard]] KResult memset_user(void* dest_ptr, int c, size_t n)
|
||||
KResult memset_user(void* dest_ptr, int c, size_t n)
|
||||
{
|
||||
bool is_user = Kernel::Memory::is_user_range(VirtualAddress(dest_ptr), n);
|
||||
if (!is_user)
|
||||
|
||||
@@ -34,9 +34,9 @@ KResultOr<Time> copy_time_from_user(Userspace<T*>);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_or_relaxed(volatile u32* var, u32 val);
|
||||
[[nodiscard]] Optional<u32> user_atomic_fetch_xor_relaxed(volatile u32* var, u32 val);
|
||||
|
||||
[[nodiscard]] KResult copy_to_user(void*, const void*, size_t);
|
||||
[[nodiscard]] KResult copy_from_user(void*, const void*, size_t);
|
||||
[[nodiscard]] KResult memset_user(void*, int, size_t);
|
||||
KResult copy_to_user(void*, const void*, size_t);
|
||||
KResult copy_from_user(void*, const void*, size_t);
|
||||
KResult memset_user(void*, int, size_t);
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
return offset_buffer;
|
||||
}
|
||||
|
||||
[[nodiscard]] KResultOr<NonnullOwnPtr<KString>> try_copy_into_kstring(size_t) const;
|
||||
KResultOr<NonnullOwnPtr<KString>> try_copy_into_kstring(size_t) const;
|
||||
[[nodiscard]] bool write(const void* src, size_t offset, size_t len);
|
||||
[[nodiscard]] bool write(const void* src, size_t len)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
template<size_t BUFFER_BYTES, typename F>
|
||||
[[nodiscard]] KResultOr<size_t> write_buffered(size_t offset, size_t len, F f)
|
||||
KResultOr<size_t> write_buffered(size_t offset, size_t len, F f)
|
||||
{
|
||||
if (!m_buffer)
|
||||
return EFAULT;
|
||||
@@ -113,13 +113,13 @@ public:
|
||||
return nwritten;
|
||||
}
|
||||
template<size_t BUFFER_BYTES, typename F>
|
||||
[[nodiscard]] KResultOr<size_t> write_buffered(size_t len, F f)
|
||||
KResultOr<size_t> write_buffered(size_t len, F f)
|
||||
{
|
||||
return write_buffered<BUFFER_BYTES, F>(0, len, f);
|
||||
}
|
||||
|
||||
template<size_t BUFFER_BYTES, typename F>
|
||||
[[nodiscard]] KResultOr<size_t> read_buffered(size_t offset, size_t len, F f) const
|
||||
KResultOr<size_t> read_buffered(size_t offset, size_t len, F f) const
|
||||
{
|
||||
if (!m_buffer)
|
||||
return EFAULT;
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
return nread;
|
||||
}
|
||||
template<size_t BUFFER_BYTES, typename F>
|
||||
[[nodiscard]] KResultOr<size_t> read_buffered(size_t len, F f) const
|
||||
KResultOr<size_t> read_buffered(size_t len, F f) const
|
||||
{
|
||||
return read_buffered<BUFFER_BYTES, F>(0, len, f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user