summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Wasser <clemens.wasser@gmail.com>2023-06-16 17:22:11 (GMT)
committerClemens Wasser <clemens.wasser@gmail.com>2023-06-22 16:11:45 (GMT)
commit64821d8a267585c0d4d9350f162690c2c518860b (patch)
tree637e60ae2fe99487066650382922f97fdf6f73e6
parent870390ee811d51b3b35f50c8aba2eaca3cce2fda (diff)
downloadCMake-64821d8a267585c0d4d9350f162690c2c518860b.zip
CMake-64821d8a267585c0d4d9350f162690c2c518860b.tar.gz
CMake-64821d8a267585c0d4d9350f162690c2c518860b.tar.bz2
cmFileLockResult: Remove expensive windows.h include
-rw-r--r--Source/cmFileLock.cxx12
-rw-r--r--Source/cmFileLockResult.cxx4
-rw-r--r--Source/cmFileLockResult.h8
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 <cerrno>
#include <cstring>
+#ifdef _WIN32
+# include <Windows.h>
+#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 <string>
-#if defined(_WIN32)
-# include <windows.h> // 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.