]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
easy_lock: fix build for mingw
authorJay Satiro <raysatiro@yahoo.com>
Fri, 1 Jul 2022 07:02:20 +0000 (03:02 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sun, 3 Jul 2022 03:52:07 +0000 (23:52 -0400)
- Define SRWLOCK symbols missing in some mingw environments.

Closes https://github.com/curl/curl/pull/8997

lib/easy_lock.h

index a4db9fe47e96e9250f4edaf314b65771f153f300..808610f8e5c5225406811a55834fad2ee4733095 100644 (file)
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
 
+#ifdef __MINGW32__
+#ifndef __MINGW64_VERSION_MAJOR
+#if (__MINGW32_MAJOR_VERSION < 5) || \
+    (__MINGW32_MAJOR_VERSION == 5 && __MINGW32_MINOR_VERSION == 0)
+/* mingw >= 5.0.1 defines SRWLOCK, and slightly different from MS define */
+typedef PVOID SRWLOCK, *PSRWLOCK;
+#endif
+#endif
+#ifndef SRWLOCK_INIT
+#define SRWLOCK_INIT NULL
+#endif
+#endif /* __MINGW32__ */
+
 #define curl_simple_lock SRWLOCK
 #define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT