diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2020-12-24 11:23:12 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-11 19:45:05 +0100 |
commit | 853cb8af5cb16080470b29f127b1d2664c4ca2c7 (patch) | |
tree | ce9033935b9abb6b1901759880213e3da592b137 /Kernel/Devices | |
parent | f99d1d3bd7d6f752c490c358217c360b7e0bda80 (diff) | |
download | serenity-853cb8af5cb16080470b29f127b1d2664c4ca2c7.zip |
DoublyLinkedList: Implement `find` in terms of `AK::find`
Problem:
- The implementation of `find` is coupled to the implementation of
`DoublyLinkedList`.
- `append` and `prepend` are implemented multiple times so that
r-value references can be moved from into the new node. This is
probably not called very often because a pr-value or x-value needs
to be used here.
Solution:
- Decouple the implementation of `find` from the class by using a
generic `find` algorithm.
- Make `append` and `prepend` be function templates so that they can
have binding references which can be forwarded.
Diffstat (limited to 'Kernel/Devices')
-rw-r--r-- | Kernel/Devices/Device.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h index 1ef8bcfa89..b97ed35b25 100644 --- a/Kernel/Devices/Device.h +++ b/Kernel/Devices/Device.h @@ -75,7 +75,7 @@ public: { ScopedSpinLock lock(m_requests_lock); was_empty = m_requests.is_empty(); - m_requests.append(request); + m_requests.append(RefPtr<AsyncDeviceRequest>(request)); } if (was_empty) request->do_start({}); |