Browse Source

Kernel: Declare type aliases with "using" instead of "typedef"

This is the idiomatic way to declare type aliases in modern C++.
Flagged by Sonar Cloud as a "Code Smell", but I happen to agree
with this particular one. :^)
Brian Gianforcaro 3 years ago
parent
commit
9d1b27263f

+ 1 - 1
Kernel/Devices/AsyncDeviceRequest.h

@@ -143,7 +143,7 @@ private:
     RequestResult m_result { Pending };
     RequestResult m_result { Pending };
     IntrusiveListNode<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>> m_list_node;
     IntrusiveListNode<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>> m_list_node;
 
 
-    typedef IntrusiveList<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>, &AsyncDeviceRequest::m_list_node> AsyncDeviceSubRequestList;
+    using AsyncDeviceSubRequestList = IntrusiveList<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>, &AsyncDeviceRequest::m_list_node>;
 
 
     AsyncDeviceSubRequestList m_sub_requests_pending;
     AsyncDeviceSubRequestList m_sub_requests_pending;
     AsyncDeviceSubRequestList m_sub_requests_complete;
     AsyncDeviceSubRequestList m_sub_requests_complete;

+ 2 - 2
Kernel/Heap/Heap.h

@@ -176,8 +176,8 @@ class ExpandableHeap {
     AK_MAKE_NONMOVABLE(ExpandableHeap);
     AK_MAKE_NONMOVABLE(ExpandableHeap);
 
 
 public:
 public:
-    typedef ExpandHeap ExpandHeapType;
-    typedef Heap<CHUNK_SIZE, HEAP_SCRUB_BYTE_ALLOC, HEAP_SCRUB_BYTE_FREE> HeapType;
+    using ExpandHeapType = ExpandHeap;
+    using HeapType = Heap<CHUNK_SIZE, HEAP_SCRUB_BYTE_ALLOC, HEAP_SCRUB_BYTE_FREE>;
 
 
     struct SubHeap {
     struct SubHeap {
         HeapType heap;
         HeapType heap;

+ 1 - 1
Kernel/Heap/kmalloc.cpp

@@ -159,7 +159,7 @@ struct KmallocGlobalHeap {
             return false;
             return false;
         }
         }
     };
     };
-    typedef ExpandableHeap<CHUNK_SIZE, KMALLOC_SCRUB_BYTE, KFREE_SCRUB_BYTE, ExpandGlobalHeap> HeapType;
+    using HeapType = ExpandableHeap<CHUNK_SIZE, KMALLOC_SCRUB_BYTE, KFREE_SCRUB_BYTE, ExpandGlobalHeap>;
 
 
     HeapType m_heap;
     HeapType m_heap;
     NonnullOwnPtrVector<Memory::Region> m_subheap_memory;
     NonnullOwnPtrVector<Memory::Region> m_subheap_memory;

+ 1 - 1
Kernel/Locking/Mutex.h

@@ -69,7 +69,7 @@ public:
     }
     }
 
 
 private:
 private:
-    typedef IntrusiveList<Thread, RawPtr<Thread>, &Thread::m_blocked_threads_list_node> BlockedThreadList;
+    using BlockedThreadList = IntrusiveList<Thread, RawPtr<Thread>, &Thread::m_blocked_threads_list_node>;
 
 
     ALWAYS_INLINE BlockedThreadList& thread_list_for_mode(Mode mode)
     ALWAYS_INLINE BlockedThreadList& thread_list_for_mode(Mode mode)
     {
     {

+ 1 - 1
Kernel/Process.h

@@ -80,7 +80,7 @@ enum class VeilState {
     Locked,
     Locked,
 };
 };
 
 
-typedef HashMap<FlatPtr, RefPtr<FutexQueue>> FutexQueues;
+using FutexQueues = HashMap<FlatPtr, RefPtr<FutexQueue>>;
 
 
 struct LoadResult;
 struct LoadResult;
 
 

+ 1 - 1
Kernel/TTY/VirtualConsole.h

@@ -130,7 +130,7 @@ private:
 
 
     Cell& cell_at(size_t column, size_t row);
     Cell& cell_at(size_t column, size_t row);
 
 
-    typedef Vector<unsigned, 4> ParamVector;
+    using ParamVector = Vector<unsigned, 4>;
 
 
     void on_code_point(u32);
     void on_code_point(u32);
 
 

+ 1 - 1
Kernel/Thread.h

@@ -680,7 +680,7 @@ public:
             BlockFlags unblocked_flags { BlockFlags::None };
             BlockFlags unblocked_flags { BlockFlags::None };
         };
         };
 
 
-        typedef Vector<FDInfo, FD_SETSIZE> FDVector;
+        using FDVector = Vector<FDInfo, FD_SETSIZE>;
         explicit SelectBlocker(FDVector&);
         explicit SelectBlocker(FDVector&);
         virtual ~SelectBlocker();
         virtual ~SelectBlocker();