From 5a0cdb15b07ef87cbab6203fad8c0dcea3634f67 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Thu, 9 Sep 2021 16:30:59 +0430 Subject: [PATCH] AK+Everywhere: Reduce the number of template parameters of IntrusiveList This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that. --- AK/IntrusiveList.h | 104 ++++++++++-------- AK/IntrusiveListRelaxedConst.h | 9 ++ AK/Queue.h | 2 +- Kernel/Bus/USB/SysFSUSB.h | 2 +- Kernel/Bus/USB/USBController.h | 2 +- Kernel/Bus/USB/USBDevice.h | 2 +- Kernel/Devices/AsyncDeviceRequest.h | 2 +- Kernel/FileSystem/BlockBasedFileSystem.cpp | 4 +- Kernel/FileSystem/Custody.h | 2 +- Kernel/FileSystem/DevTmpFS.h | 2 +- Kernel/FileSystem/Inode.h | 2 +- Kernel/FileSystem/SysFS.h | 2 +- Kernel/FileSystem/TmpFS.h | 2 +- Kernel/Interrupts/GenericInterruptHandler.h | 2 +- Kernel/Locking/Mutex.h | 2 +- Kernel/Memory/PhysicalZone.h | 2 +- Kernel/Memory/Region.h | 4 +- Kernel/Memory/VMObject.h | 2 +- Kernel/Net/IPv4Socket.h | 2 +- Kernel/Net/LocalSocket.h | 2 +- Kernel/Net/NetworkAdapter.h | 2 +- Kernel/Net/TCPSocket.h | 2 +- Kernel/Process.h | 2 +- Kernel/ProcessGroup.h | 2 +- Kernel/Scheduler.cpp | 2 +- Kernel/Storage/StorageManagement.h | 2 +- Kernel/TTY/SlavePTY.h | 2 +- Kernel/Thread.h | 4 +- Kernel/TimerQueue.h | 2 +- Kernel/WorkQueue.h | 2 +- Tests/AK/TestIntrusiveList.cpp | 6 +- Userland/Libraries/LibC/mallocdefs.h | 2 +- Userland/Libraries/LibCore/Object.cpp | 4 +- Userland/Libraries/LibCore/Object.h | 2 +- Userland/Libraries/LibGUI/MouseTracker.h | 2 +- Userland/Libraries/LibJS/Heap/CellAllocator.h | 2 +- Userland/Libraries/LibJS/Heap/Handle.h | 2 +- .../Libraries/LibJS/Runtime/MarkedValueList.h | 2 +- .../Libraries/LibJS/Runtime/WeakContainer.h | 2 +- Userland/Services/WindowServer/Compositor.h | 2 +- Userland/Services/WindowServer/Window.h | 2 +- 41 files changed, 111 insertions(+), 92 deletions(-) diff --git a/AK/IntrusiveList.h b/AK/IntrusiveList.h index d7dc93c9b33..b485443980f 100644 --- a/AK/IntrusiveList.h +++ b/AK/IntrusiveList.h @@ -13,29 +13,34 @@ #include #include -namespace AK { +namespace AK::Detail { -namespace Detail { template> class IntrusiveListNode; -} + +struct ExtractIntrusiveListTypes { + template + static V value(IntrusiveListNode T::*x); + template + static Container container(IntrusiveListNode T::*x); +}; template> -using IntrusiveListNode = Detail::IntrusiveListNode::Type>; +using SubstitutedIntrusiveListNode = IntrusiveListNode::Type>; template class IntrusiveListStorage { private: - friend class Detail::IntrusiveListNode; + friend class IntrusiveListNode; - template T_::*member> + template T_::*member> friend class IntrusiveList; - IntrusiveListNode* m_first { nullptr }; - IntrusiveListNode* m_last { nullptr }; + SubstitutedIntrusiveListNode* m_first { nullptr }; + SubstitutedIntrusiveListNode* m_last { nullptr }; }; -template T::*member> +template T::*member> class IntrusiveList { AK_MAKE_NONCOPYABLE(IntrusiveList); AK_MAKE_NONMOVABLE(IntrusiveList); @@ -144,12 +149,10 @@ private: static T* prev(T* current); static const T* next(const T* current); static const T* prev(const T* current); - static T* node_to_value(IntrusiveListNode& node); + static T* node_to_value(SubstitutedIntrusiveListNode& node); IntrusiveListStorage m_storage; }; -namespace Detail { - template class IntrusiveListNode { public: @@ -159,23 +162,21 @@ public: static constexpr bool IsRaw = IsPointer; - // Note: For some reason, clang does not consider `member` as declared here, and as declared above (`IntrusiveListNode T::*`) + // Note: For some reason, clang does not consider `member` as declared here, and as declared above (`SubstitutedIntrusiveListNode T::*`) // to be of equal types. so for now, just make the members public on clang. #ifndef __clang__ private: - template T_::*member> - friend class ::AK::IntrusiveList; + template T_::*member> + friend class ::AK::Detail::IntrusiveList; #endif IntrusiveListStorage* m_storage = nullptr; - IntrusiveListNode* m_next = nullptr; - IntrusiveListNode* m_prev = nullptr; + SubstitutedIntrusiveListNode* m_next = nullptr; + SubstitutedIntrusiveListNode* m_prev = nullptr; [[no_unique_address]] SelfReferenceIfNeeded m_self; }; -} - -template T::*member> +template T::*member> inline typename IntrusiveList::Iterator& IntrusiveList::Iterator::erase() { auto old = m_value; @@ -184,26 +185,26 @@ inline typename IntrusiveList::Iterator& IntrusiveList T::*member> +template T::*member> inline IntrusiveList::~IntrusiveList() { clear(); } -template T::*member> +template T::*member> inline void IntrusiveList::clear() { while (m_storage.m_first) m_storage.m_first->remove(); } -template T::*member> +template T::*member> inline bool IntrusiveList::is_empty() const { return m_storage.m_first == nullptr; } -template T::*member> +template T::*member> inline size_t IntrusiveList::size_slow() const { size_t size = 0; @@ -214,7 +215,7 @@ inline size_t IntrusiveList::size_slow() const return size; } -template T::*member> +template T::*member> inline void IntrusiveList::append(T& n) { remove(n); @@ -233,7 +234,7 @@ inline void IntrusiveList::append(T& n) m_storage.m_first = &nnode; } -template T::*member> +template T::*member> inline void IntrusiveList::prepend(T& n) { remove(n); @@ -252,7 +253,7 @@ inline void IntrusiveList::prepend(T& n) m_storage.m_last = &nnode; } -template T::*member> +template T::*member> inline void IntrusiveList::insert_before(T& bn, T& n) { remove(n); @@ -274,7 +275,7 @@ inline void IntrusiveList::insert_before(T& bn, T& n) new_node.m_self.reference = &n; } -template T::*member> +template T::*member> inline void IntrusiveList::remove(T& n) { auto& nnode = n.*member; @@ -282,20 +283,20 @@ inline void IntrusiveList::remove(T& n) nnode.remove(); } -template T::*member> +template T::*member> inline bool IntrusiveList::contains(const T& n) const { auto& nnode = n.*member; return nnode.m_storage == &m_storage; } -template T::*member> +template T::*member> inline Container IntrusiveList::first() const { return m_storage.m_first ? node_to_value(*m_storage.m_first) : nullptr; } -template T::*member> +template T::*member> inline Container IntrusiveList::take_first() { if (Container ptr = first()) { @@ -305,7 +306,7 @@ inline Container IntrusiveList::take_first() return nullptr; } -template T::*member> +template T::*member> inline Container IntrusiveList::take_last() { if (Container ptr = last()) { @@ -315,13 +316,13 @@ inline Container IntrusiveList::take_last() return nullptr; } -template T::*member> +template T::*member> inline Container IntrusiveList::last() const { return m_storage.m_last ? node_to_value(*m_storage.m_last) : nullptr; } -template T::*member> +template T::*member> inline const T* IntrusiveList::next(const T* current) { auto& nextnode = (current->*member).m_next; @@ -329,7 +330,7 @@ inline const T* IntrusiveList::next(const T* current) return nextstruct; } -template T::*member> +template T::*member> inline const T* IntrusiveList::prev(const T* current) { auto& prevnode = (current->*member).m_prev; @@ -337,7 +338,7 @@ inline const T* IntrusiveList::prev(const T* current) return prevstruct; } -template T::*member> +template T::*member> inline T* IntrusiveList::next(T* current) { auto& nextnode = (current->*member).m_next; @@ -345,7 +346,7 @@ inline T* IntrusiveList::next(T* current) return nextstruct; } -template T::*member> +template T::*member> inline T* IntrusiveList::prev(T* current) { auto& prevnode = (current->*member).m_prev; @@ -353,26 +354,26 @@ inline T* IntrusiveList::prev(T* current) return prevstruct; } -template T::*member> +template T::*member> inline typename IntrusiveList::Iterator IntrusiveList::begin() { return m_storage.m_first ? Iterator(node_to_value(*m_storage.m_first)) : Iterator(); } -template T::*member> +template T::*member> inline typename IntrusiveList::ReverseIterator IntrusiveList::rbegin() { return m_storage.m_last ? ReverseIterator(node_to_value(*m_storage.m_last)) : ReverseIterator(); } -template T::*member> +template T::*member> inline typename IntrusiveList::ConstIterator IntrusiveList::begin() const { return m_storage.m_first ? ConstIterator(node_to_value(*m_storage.m_first)) : ConstIterator(); } -template T::*member> -inline T* IntrusiveList::node_to_value(IntrusiveListNode& node) +template T::*member> +inline T* IntrusiveList::node_to_value(SubstitutedIntrusiveListNode& node) { // Note: Since this might seem odd, here's an explanation on what this function actually does: // `node` is a reference that resides in some part of the actual value (of type T), the @@ -383,8 +384,6 @@ inline T* IntrusiveList::node_to_value(IntrusiveListNode(bit_cast(&node) - bit_cast(member)); } -namespace Detail { - template inline IntrusiveListNode::~IntrusiveListNode() { @@ -416,13 +415,11 @@ inline bool IntrusiveListNode::is_in_list() const return m_storage != nullptr; } -} - // Specialise IntrusiveList for NonnullRefPtr // By default, intrusive lists cannot contain null entries anyway, so switch to RefPtr // and just make the user-facing functions deref the pointers. -template> T::*member> +template> T::*member> class IntrusiveList, member> : public IntrusiveList, member> { public: [[nodiscard]] NonnullRefPtr first() const { return *IntrusiveList, member>::first(); } @@ -434,5 +431,18 @@ public: } +namespace AK { + +template> +using IntrusiveListNode = Detail::SubstitutedIntrusiveListNode; + +template +using IntrusiveList = Detail::IntrusiveList< + decltype(Detail::ExtractIntrusiveListTypes::value(member)), + decltype(Detail::ExtractIntrusiveListTypes::container(member)), + member>; + +} + using AK::IntrusiveList; using AK::IntrusiveListNode; diff --git a/AK/IntrusiveListRelaxedConst.h b/AK/IntrusiveListRelaxedConst.h index 9c431972e03..da94b1cc00a 100644 --- a/AK/IntrusiveListRelaxedConst.h +++ b/AK/IntrusiveListRelaxedConst.h @@ -9,6 +9,7 @@ #include namespace AK { +namespace Detail { template T::*member> class IntrusiveListRelaxedConst : public IntrusiveList { @@ -26,4 +27,12 @@ public: } +template +using IntrusiveListRelaxedConst = Detail::IntrusiveListRelaxedConst< + decltype(Detail::ExtractIntrusiveListTypes::value(member)), + decltype(Detail::ExtractIntrusiveListTypes::container(member)), + member>; + +} + using AK::IntrusiveListRelaxedConst; diff --git a/AK/Queue.h b/AK/Queue.h index c87750a8792..448856a6653 100644 --- a/AK/Queue.h +++ b/AK/Queue.h @@ -76,7 +76,7 @@ private: IntrusiveListNode node; }; - IntrusiveList, &QueueSegment::node> m_segments; + IntrusiveList<&QueueSegment::node> m_segments; size_t m_index_into_first { 0 }; size_t m_size { 0 }; }; diff --git a/Kernel/Bus/USB/SysFSUSB.h b/Kernel/Bus/USB/SysFSUSB.h index 69b91136fcc..2380235647c 100644 --- a/Kernel/Bus/USB/SysFSUSB.h +++ b/Kernel/Bus/USB/SysFSUSB.h @@ -54,7 +54,7 @@ private: RefPtr device_node_for(USB::Device& device); - IntrusiveList, &SysFSUSBDeviceInformation::m_list_node> m_device_nodes; + IntrusiveList<&SysFSUSBDeviceInformation::m_list_node> m_device_nodes; mutable Spinlock m_lock; }; diff --git a/Kernel/Bus/USB/USBController.h b/Kernel/Bus/USB/USBController.h index 3a97e34ab07..3d93bd9e128 100644 --- a/Kernel/Bus/USB/USBController.h +++ b/Kernel/Bus/USB/USBController.h @@ -33,7 +33,7 @@ private: IntrusiveListNode> m_controller_list_node; public: - using List = IntrusiveList, &USBController::m_controller_list_node>; + using List = IntrusiveList<&USBController::m_controller_list_node>; }; } diff --git a/Kernel/Bus/USB/USBDevice.h b/Kernel/Bus/USB/USBDevice.h index e55aff775d6..caefbe66c5d 100644 --- a/Kernel/Bus/USB/USBDevice.h +++ b/Kernel/Bus/USB/USBDevice.h @@ -64,6 +64,6 @@ private: IntrusiveListNode> m_hub_child_node; public: - using List = IntrusiveList, &Device::m_hub_child_node>; + using List = IntrusiveList<&Device::m_hub_child_node>; }; } diff --git a/Kernel/Devices/AsyncDeviceRequest.h b/Kernel/Devices/AsyncDeviceRequest.h index a7c2663b50d..1bd60e571ac 100644 --- a/Kernel/Devices/AsyncDeviceRequest.h +++ b/Kernel/Devices/AsyncDeviceRequest.h @@ -143,7 +143,7 @@ private: RequestResult m_result { Pending }; IntrusiveListNode> m_list_node; - using AsyncDeviceSubRequestList = IntrusiveList, &AsyncDeviceRequest::m_list_node>; + using AsyncDeviceSubRequestList = IntrusiveList<&AsyncDeviceRequest::m_list_node>; AsyncDeviceSubRequestList m_sub_requests_pending; AsyncDeviceSubRequestList m_sub_requests_complete; diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 416558bf096..346a839e972 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -97,8 +97,8 @@ public: private: BlockBasedFileSystem& m_fs; mutable HashMap m_hash; - mutable IntrusiveList, &CacheEntry::list_node> m_clean_list; - mutable IntrusiveList, &CacheEntry::list_node> m_dirty_list; + mutable IntrusiveList<&CacheEntry::list_node> m_clean_list; + mutable IntrusiveList<&CacheEntry::list_node> m_dirty_list; NonnullOwnPtr m_cached_block_data; NonnullOwnPtr m_entries; bool m_dirty { false }; diff --git a/Kernel/FileSystem/Custody.h b/Kernel/FileSystem/Custody.h index ac795bf4a4c..52e0facf903 100644 --- a/Kernel/FileSystem/Custody.h +++ b/Kernel/FileSystem/Custody.h @@ -50,7 +50,7 @@ private: mutable IntrusiveListNode m_all_custodies_list_node; public: - using AllCustodiesList = IntrusiveList, &Custody::m_all_custodies_list_node>; + using AllCustodiesList = IntrusiveList<&Custody::m_all_custodies_list_node>; }; } diff --git a/Kernel/FileSystem/DevTmpFS.h b/Kernel/FileSystem/DevTmpFS.h index df7cfd2260e..d2545599ead 100644 --- a/Kernel/FileSystem/DevTmpFS.h +++ b/Kernel/FileSystem/DevTmpFS.h @@ -143,7 +143,7 @@ protected: DevTmpFSDirectoryInode(DevTmpFS&, NonnullOwnPtr name); // ^Inode OwnPtr m_name; - IntrusiveList, &DevTmpFSInode::m_list_node> m_nodes; + IntrusiveList<&DevTmpFSInode::m_list_node> m_nodes; private: explicit DevTmpFSDirectoryInode(DevTmpFS&); diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 646cd068f12..d0e0b927b40 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -134,7 +134,7 @@ private: Vector m_flocks; public: - using AllInstancesList = IntrusiveList, &Inode::m_inode_list_node>; + using AllInstancesList = IntrusiveList<&Inode::m_inode_list_node>; static SpinlockProtected& all_instances(); }; diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h index c3523629c61..08a5c821351 100644 --- a/Kernel/FileSystem/SysFS.h +++ b/Kernel/FileSystem/SysFS.h @@ -81,7 +81,7 @@ private: }; class SysFSComponentRegistry { - using DevicesList = MutexProtected, &SysFSDeviceComponent::m_list_node>>; + using DevicesList = MutexProtected>; public: static SysFSComponentRegistry& the(); diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index 4c4f930bfe9..87441885b66 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -79,7 +79,7 @@ private: NonnullOwnPtr name; NonnullRefPtr inode; IntrusiveListNode list_node {}; - using List = IntrusiveList, &Child::list_node>; + using List = IntrusiveList<&Child::list_node>; }; Child* find_child_by_name(StringView); diff --git a/Kernel/Interrupts/GenericInterruptHandler.h b/Kernel/Interrupts/GenericInterruptHandler.h index b4a96ec385e..3572de6afbd 100644 --- a/Kernel/Interrupts/GenericInterruptHandler.h +++ b/Kernel/Interrupts/GenericInterruptHandler.h @@ -68,6 +68,6 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &GenericInterruptHandler::m_list_node>; + using List = IntrusiveList<&GenericInterruptHandler::m_list_node>; }; } diff --git a/Kernel/Locking/Mutex.h b/Kernel/Locking/Mutex.h index be9a547dfc8..54748e3ce13 100644 --- a/Kernel/Locking/Mutex.h +++ b/Kernel/Locking/Mutex.h @@ -69,7 +69,7 @@ public: } private: - using BlockedThreadList = IntrusiveList, &Thread::m_blocked_threads_list_node>; + using BlockedThreadList = IntrusiveList<&Thread::m_blocked_threads_list_node>; ALWAYS_INLINE BlockedThreadList& thread_list_for_mode(Mode mode) { diff --git a/Kernel/Memory/PhysicalZone.h b/Kernel/Memory/PhysicalZone.h index c5512f8f24e..d97d7449b27 100644 --- a/Kernel/Memory/PhysicalZone.h +++ b/Kernel/Memory/PhysicalZone.h @@ -89,7 +89,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &PhysicalZone::m_list_node>; + using List = IntrusiveList<&PhysicalZone::m_list_node>; }; } diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h index 10020e91046..1b02cf6d127 100644 --- a/Kernel/Memory/Region.h +++ b/Kernel/Memory/Region.h @@ -217,8 +217,8 @@ private: IntrusiveListNode m_vmobject_list_node; public: - using ListInMemoryManager = IntrusiveList, &Region::m_memory_manager_list_node>; - using ListInVMObject = IntrusiveList, &Region::m_vmobject_list_node>; + using ListInMemoryManager = IntrusiveList<&Region::m_memory_manager_list_node>; + using ListInVMObject = IntrusiveList<&Region::m_vmobject_list_node>; }; AK_ENUM_BITWISE_OPERATORS(Region::Access) diff --git a/Kernel/Memory/VMObject.h b/Kernel/Memory/VMObject.h index 9531c53e987..e6079dd22bb 100644 --- a/Kernel/Memory/VMObject.h +++ b/Kernel/Memory/VMObject.h @@ -73,7 +73,7 @@ private: Region::ListInVMObject m_regions; public: - using AllInstancesList = IntrusiveList, &VMObject::m_list_node>; + using AllInstancesList = IntrusiveList<&VMObject::m_list_node>; static SpinlockProtected& all_instances(); }; diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index d4163056016..786d813c99b 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -133,7 +133,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &IPv4Socket::m_list_node>; + using List = IntrusiveList<&IPv4Socket::m_list_node>; static MutexProtected& all_sockets(); }; diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index 315fe8d9594..96e0322f6bb 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -105,7 +105,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &LocalSocket::m_list_node>; + using List = IntrusiveList<&LocalSocket::m_list_node>; }; } diff --git a/Kernel/Net/NetworkAdapter.h b/Kernel/Net/NetworkAdapter.h index 38894f6ff66..6ffe197c0fc 100644 --- a/Kernel/Net/NetworkAdapter.h +++ b/Kernel/Net/NetworkAdapter.h @@ -111,7 +111,7 @@ private: // FIXME: Make this configurable static constexpr size_t max_packet_buffers = 1024; - using PacketList = IntrusiveList, &PacketWithTimestamp::packet_node>; + using PacketList = IntrusiveList<&PacketWithTimestamp::packet_node>; PacketList m_packet_queue; size_t m_packet_queue_size { 0 }; diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index ccbaf9922d4..b5c812aeeae 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -225,7 +225,7 @@ private: IntrusiveListNode m_retransmit_list_node; public: - using RetransmitList = IntrusiveList, &TCPSocket::m_retransmit_list_node>; + using RetransmitList = IntrusiveList<&TCPSocket::m_retransmit_list_node>; static MutexProtected& sockets_for_retransmit(); }; diff --git a/Kernel/Process.h b/Kernel/Process.h index 4ed9107869c..4b89e1954a5 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -807,7 +807,7 @@ private: u8 m_protected_values_padding[PAGE_SIZE - sizeof(ProtectedValues)]; public: - using List = IntrusiveListRelaxedConst, &Process::m_list_node>; + using List = IntrusiveListRelaxedConst<&Process::m_list_node>; }; // Note: Process object should be 2 pages of 4096 bytes each. diff --git a/Kernel/ProcessGroup.h b/Kernel/ProcessGroup.h index 63d35bb5a1e..de5bf0ed215 100644 --- a/Kernel/ProcessGroup.h +++ b/Kernel/ProcessGroup.h @@ -40,7 +40,7 @@ private: ProcessGroupID m_pgid; public: - using List = IntrusiveList, &ProcessGroup::m_list_node>; + using List = IntrusiveList<&ProcessGroup::m_list_node>; }; SpinlockProtected& process_groups(); diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index a17d135171a..2544ed3c5a7 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -38,7 +38,7 @@ Atomic g_finalizer_has_work { false }; READONLY_AFTER_INIT static Process* s_colonel_process; struct ThreadReadyQueue { - IntrusiveList, &Thread::m_ready_queue_node> thread_list; + IntrusiveList<&Thread::m_ready_queue_node> thread_list; }; struct ThreadReadyQueues { diff --git a/Kernel/Storage/StorageManagement.h b/Kernel/Storage/StorageManagement.h index 70c30be50c1..b648110836c 100644 --- a/Kernel/Storage/StorageManagement.h +++ b/Kernel/Storage/StorageManagement.h @@ -51,7 +51,7 @@ private: String m_boot_argument; WeakPtr m_boot_block_device; NonnullRefPtrVector m_controllers; - IntrusiveList, &StorageDevice::m_list_node> m_storage_devices; + IntrusiveList<&StorageDevice::m_list_node> m_storage_devices; }; } diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h index d4dd4d8e7da..3d10eaed760 100644 --- a/Kernel/TTY/SlavePTY.h +++ b/Kernel/TTY/SlavePTY.h @@ -49,7 +49,7 @@ private: mutable IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &SlavePTY::m_list_node>; + using List = IntrusiveList<&SlavePTY::m_list_node>; static SpinlockProtected& all_instances(); }; diff --git a/Kernel/Thread.h b/Kernel/Thread.h index a500aa07901..87bf490e7d5 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -1372,8 +1372,8 @@ private: mutable IntrusiveListNode m_global_thread_list_node; public: - using ListInProcess = IntrusiveList, &Thread::m_process_thread_list_node>; - using GlobalList = IntrusiveList, &Thread::m_global_thread_list_node>; + using ListInProcess = IntrusiveList<&Thread::m_process_thread_list_node>; + using GlobalList = IntrusiveList<&Thread::m_global_thread_list_node>; static SpinlockProtected& all_instances(); }; diff --git a/Kernel/TimerQueue.h b/Kernel/TimerQueue.h index d243609cb9f..e795db7b481 100644 --- a/Kernel/TimerQueue.h +++ b/Kernel/TimerQueue.h @@ -77,7 +77,7 @@ private: public: IntrusiveListNode m_list_node; - using List = IntrusiveList, &Timer::m_list_node>; + using List = IntrusiveList<&Timer::m_list_node>; }; class TimerQueue { diff --git a/Kernel/WorkQueue.h b/Kernel/WorkQueue.h index 90756998d67..c30a272c17a 100644 --- a/Kernel/WorkQueue.h +++ b/Kernel/WorkQueue.h @@ -51,7 +51,7 @@ private: RefPtr m_thread; WaitQueue m_wait_queue; - IntrusiveList, &WorkItem::m_node> m_items; + IntrusiveList<&WorkItem::m_node> m_items; Spinlock m_lock; }; diff --git a/Tests/AK/TestIntrusiveList.cpp b/Tests/AK/TestIntrusiveList.cpp index 923de96f3e0..ef240152478 100644 --- a/Tests/AK/TestIntrusiveList.cpp +++ b/Tests/AK/TestIntrusiveList.cpp @@ -15,7 +15,7 @@ public: IntrusiveTestItem() = default; IntrusiveListNode m_list_node; }; -using IntrusiveTestList = IntrusiveList, &IntrusiveTestItem::m_list_node>; +using IntrusiveTestList = IntrusiveList<&IntrusiveTestItem::m_list_node>; TEST_CASE(construct) { @@ -91,7 +91,7 @@ public: IntrusiveRefPtrItem() = default; IntrusiveListNode> m_list_node; }; -using IntrusiveRefPtrList = IntrusiveList, &IntrusiveRefPtrItem::m_list_node>; +using IntrusiveRefPtrList = IntrusiveList<&IntrusiveRefPtrItem::m_list_node>; TEST_CASE(intrusive_ref_ptr_no_ref_leaks) { @@ -138,7 +138,7 @@ public: IntrusiveNonnullRefPtrItem() = default; IntrusiveListNode> m_list_node; }; -using IntrusiveNonnullRefPtrList = IntrusiveList, &IntrusiveNonnullRefPtrItem::m_list_node>; +using IntrusiveNonnullRefPtrList = IntrusiveList<&IntrusiveNonnullRefPtrItem::m_list_node>; TEST_CASE(intrusive_nonnull_ref_ptr_intrusive) { diff --git a/Userland/Libraries/LibC/mallocdefs.h b/Userland/Libraries/LibC/mallocdefs.h index a4aad0e1327..da4c8c61a59 100644 --- a/Userland/Libraries/LibC/mallocdefs.h +++ b/Userland/Libraries/LibC/mallocdefs.h @@ -75,5 +75,5 @@ struct ChunkedBlock : public CommonHeader { size_t used_chunks() const { return chunk_capacity() - m_free_chunks; } size_t chunk_capacity() const { return (block_size - sizeof(ChunkedBlock)) / m_size; } - using List = IntrusiveList, &ChunkedBlock::m_list_node>; + using List = IntrusiveList<&ChunkedBlock::m_list_node>; }; diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index 088c4655156..8df07836c0e 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -14,9 +14,9 @@ namespace Core { -IntrusiveList, &Object::m_all_objects_list_node>& Object::all_objects() +IntrusiveList<&Object::m_all_objects_list_node>& Object::all_objects() { - static IntrusiveList, &Object::m_all_objects_list_node> objects; + static IntrusiveList<&Object::m_all_objects_list_node> objects; return objects; } diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 01b12e509b9..6fbbf1918d8 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -137,7 +137,7 @@ public: JsonValue property(String const& name) const; const HashMap>& properties() const { return m_properties; } - static IntrusiveList, &Object::m_all_objects_list_node>& all_objects(); + static IntrusiveList<&Object::m_all_objects_list_node>& all_objects(); void dispatch_event(Core::Event&, Object* stay_within = nullptr); diff --git a/Userland/Libraries/LibGUI/MouseTracker.h b/Userland/Libraries/LibGUI/MouseTracker.h index 08971062486..f22e60f1f97 100644 --- a/Userland/Libraries/LibGUI/MouseTracker.h +++ b/Userland/Libraries/LibGUI/MouseTracker.h @@ -26,7 +26,7 @@ protected: private: IntrusiveListNode m_list_node; - using List = IntrusiveList, &MouseTracker::m_list_node>; + using List = IntrusiveList<&MouseTracker::m_list_node>; static List s_trackers; }; diff --git a/Userland/Libraries/LibJS/Heap/CellAllocator.h b/Userland/Libraries/LibJS/Heap/CellAllocator.h index 9ce1488601f..43edfe69ffd 100644 --- a/Userland/Libraries/LibJS/Heap/CellAllocator.h +++ b/Userland/Libraries/LibJS/Heap/CellAllocator.h @@ -43,7 +43,7 @@ public: private: const size_t m_cell_size; - using BlockList = IntrusiveList, &HeapBlock::m_list_node>; + using BlockList = IntrusiveList<&HeapBlock::m_list_node>; BlockList m_full_blocks; BlockList m_usable_blocks; }; diff --git a/Userland/Libraries/LibJS/Heap/Handle.h b/Userland/Libraries/LibJS/Heap/Handle.h index b9eab8a225d..07d01941ab1 100644 --- a/Userland/Libraries/LibJS/Heap/Handle.h +++ b/Userland/Libraries/LibJS/Heap/Handle.h @@ -35,7 +35,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &HandleImpl::m_list_node>; + using List = IntrusiveList<&HandleImpl::m_list_node>; }; template diff --git a/Userland/Libraries/LibJS/Runtime/MarkedValueList.h b/Userland/Libraries/LibJS/Runtime/MarkedValueList.h index 86419255b13..a3ec8bf9db5 100644 --- a/Userland/Libraries/LibJS/Runtime/MarkedValueList.h +++ b/Userland/Libraries/LibJS/Runtime/MarkedValueList.h @@ -39,7 +39,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &MarkedValueList::m_list_node>; + using List = IntrusiveList<&MarkedValueList::m_list_node>; }; } diff --git a/Userland/Libraries/LibJS/Runtime/WeakContainer.h b/Userland/Libraries/LibJS/Runtime/WeakContainer.h index 4ac251279f2..8e469fb9ed5 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakContainer.h +++ b/Userland/Libraries/LibJS/Runtime/WeakContainer.h @@ -27,7 +27,7 @@ private: IntrusiveListNode m_list_node; public: - using List = IntrusiveList, &WeakContainer::m_list_node>; + using List = IntrusiveList<&WeakContainer::m_list_node>; }; } diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index 4d7f9a4d7ff..bb11f730560 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -220,7 +220,7 @@ private: bool m_invalidated_cursor { false }; bool m_overlay_rects_changed { false }; - IntrusiveList, &Overlay::m_list_node> m_overlay_list; + IntrusiveList<&Overlay::m_list_node> m_overlay_list; Gfx::DisjointRectSet m_overlay_rects; Gfx::DisjointRectSet m_dirty_screen_rects; Gfx::DisjointRectSet m_opaque_wallpaper_rects; diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index 4d5c7771be2..edf8669095e 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -469,7 +469,7 @@ private: RefPtr m_animation; public: - using List = IntrusiveList, &Window::m_list_node>; + using List = IntrusiveList<&Window::m_list_node>; }; }