From 00618db5ffbe9afb14a1a86e722c826cc6e865d0 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 17 Aug 2022 20:02:10 +0800 Subject: [PATCH] QSystemLibrary: Use in-class initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initialize the member variables in class. It's more modern and also saves some typing in some constructor functions. Change-Id: Ib4d942610a57e0af3f22248c00207d7cdb683763 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/plugin/qsystemlibrary_p.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index ebdcaa7b74..0b4ad7dbc2 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -28,15 +28,11 @@ public: explicit QSystemLibrary(const QString &libraryName) { m_libraryName = libraryName; - m_handle = nullptr; - m_didLoad = false; } explicit QSystemLibrary(const wchar_t *libraryName) { m_libraryName = QString::fromWCharArray(libraryName); - m_handle = nullptr; - m_didLoad = false; } bool load(bool onlySystemDirectory = true) @@ -66,10 +62,11 @@ public: } static Q_CORE_EXPORT HINSTANCE load(const wchar_t *lpFileName, bool onlySystemDirectory = true); + private: - HINSTANCE m_handle; - QString m_libraryName; - bool m_didLoad; + HINSTANCE m_handle = nullptr; + QString m_libraryName = {}; + bool m_didLoad = false; }; QT_END_NAMESPACE