From e2d154c74da2ff5c9d9fde36c37c57e0a6c56c93 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Thu, 16 Sep 2021 00:00:32 -0700 Subject: [PATCH] LibJS: Use default instead of an empty constructor/destructor Default implementations allow for more optimizations. See: https://pvs-studio.com/en/docs/warnings/v832/ --- Userland/Libraries/LibJS/Heap/CellAllocator.cpp | 4 ---- Userland/Libraries/LibJS/Heap/CellAllocator.h | 2 +- Userland/Libraries/LibJS/Heap/Handle.h | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibJS/Heap/CellAllocator.cpp b/Userland/Libraries/LibJS/Heap/CellAllocator.cpp index 63e6e38fcf..e7b86ec040 100644 --- a/Userland/Libraries/LibJS/Heap/CellAllocator.cpp +++ b/Userland/Libraries/LibJS/Heap/CellAllocator.cpp @@ -17,10 +17,6 @@ CellAllocator::CellAllocator(size_t cell_size) { } -CellAllocator::~CellAllocator() -{ -} - Cell* CellAllocator::allocate_cell(Heap& heap) { if (m_usable_blocks.is_empty()) { diff --git a/Userland/Libraries/LibJS/Heap/CellAllocator.h b/Userland/Libraries/LibJS/Heap/CellAllocator.h index 43edfe69ff..737f0ab408 100644 --- a/Userland/Libraries/LibJS/Heap/CellAllocator.h +++ b/Userland/Libraries/LibJS/Heap/CellAllocator.h @@ -17,7 +17,7 @@ namespace JS { class CellAllocator { public: explicit CellAllocator(size_t cell_size); - ~CellAllocator(); + ~CellAllocator() = default; size_t cell_size() const { return m_cell_size; } diff --git a/Userland/Libraries/LibJS/Heap/Handle.h b/Userland/Libraries/LibJS/Heap/Handle.h index 07d01941ab..2ebc35770c 100644 --- a/Userland/Libraries/LibJS/Heap/Handle.h +++ b/Userland/Libraries/LibJS/Heap/Handle.h @@ -41,7 +41,7 @@ public: template class Handle { public: - Handle() { } + Handle() = default; static Handle create(T* cell) {