}
#else
-#ifdef _MSC_VER
-#ifndef _CRT_NONSTDC_NO_DEPRECATE
-#define _CRT_NONSTDC_NO_DEPRECATE /* for strdup() */
-#endif
-#endif
-
#ifdef _WIN32
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
#undef _WIN32_WINNT
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
+#define strdup _strdup
#else
#include <sys/types.h>
#include <sys/socket.h>
#pragma warning(disable:4127)
/* Avoid VS2005 and upper complaining about portable C functions. */
#ifndef _CRT_NONSTDC_NO_DEPRECATE /* mingw-w64 v2+. MS SDK ~10+/~VS2017+. */
-#define _CRT_NONSTDC_NO_DEPRECATE /* for close(), fileno(), strdup(),
- unlink(), etc. */
+#define _CRT_NONSTDC_NO_DEPRECATE /* for close(), fileno(), unlink(), etc. */
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS /* for getenv(), gmtime(), strcpy(),
* so the callback pointer is initialized correctly.
*/
#ifdef HAVE_STRDUP
+#ifdef _WIN32
+#define system_strdup _strdup
+#else
#define system_strdup strdup
+#endif
#else
#define system_strdup Curl_strdup
#endif
curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;
curl_free_callback Curl_cfree = (curl_free_callback)free;
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
+#ifdef _WIN32
+curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)_strdup;
+#else
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup;
+#endif
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
#if defined(_MSC_VER) && defined(_DLL)
# define snprintf _snprintf
#endif
+#ifdef _WIN32
+# define strdup _strdup
+#endif
+
#ifdef _WIN32
# define CURL_STRNICMP(p1, p2, n) _strnicmp(p1, p2, n)
#elif defined(HAVE_STRCASECMP)