From 64821d8a267585c0d4d9350f162690c2c518860b Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 19:22:11 +0200 Subject: cmFileLockResult: Remove expensive windows.h include --- Source/cmFileLock.cxx | 12 ++---------- Source/cmFileLockResult.cxx | 4 ++++ Source/cmFileLockResult.h | 8 -------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index 5d197d2..548e327 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -12,11 +12,7 @@ cmFileLock::cmFileLock(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); } @@ -32,11 +28,7 @@ cmFileLock::~cmFileLock() cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); return *this; diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx index b7f7f38..632c0e9 100644 --- a/Source/cmFileLockResult.cxx +++ b/Source/cmFileLockResult.cxx @@ -5,6 +5,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + cmFileLockResult cmFileLockResult::MakeOk() { return { OK, 0 }; diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h index 8a58d1f..e252de7 100644 --- a/Source/cmFileLockResult.h +++ b/Source/cmFileLockResult.h @@ -6,10 +6,6 @@ #include -#if defined(_WIN32) -# include // DWORD -#endif - /** * @brief Result of the locking/unlocking file. * @note See @c cmFileLock @@ -17,11 +13,7 @@ class cmFileLockResult { public: -#if defined(_WIN32) - using Error = DWORD; -#else using Error = int; -#endif /** * @brief Successful lock/unlock. -- cgit v0.12