summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/curl_memory.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-06 21:44:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-06 21:44:17 +0300
commit4b6980f68d25901133519bc1ad1c5376819a3876 (patch)
tree0d919622bfc2659f34a7bed303fefb99ecab052a /libs/libcurl/src/curl_memory.h
parent0112d2767268037cf63e44c4464cf9eed237d06d (diff)
libcurl: update to 7.57
Diffstat (limited to 'libs/libcurl/src/curl_memory.h')
-rw-r--r--libs/libcurl/src/curl_memory.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/libs/libcurl/src/curl_memory.h b/libs/libcurl/src/curl_memory.h
index adc45cd639..fccf46879a 100644
--- a/libs/libcurl/src/curl_memory.h
+++ b/libs/libcurl/src/curl_memory.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@@ -28,6 +28,9 @@
* File curl_memory.h must be included by _all_ *.c source files
* that use memory related functions strdup, malloc, calloc, realloc
* or free, and given source file is used to build libcurl library.
+ * It should be included immediately before memdebug.h as the last files
+ * included to avoid undesired interaction with other memory function
+ * headers in dependent libraries.
*
* There is nearly no exception to above rule. All libcurl source
* files in 'lib' subdirectory as well as those living deep inside
@@ -67,7 +70,7 @@
*
* Programs and libraries in 'tests' subdirectories have specific
* purposes and needs, and as such each one will use whatever fits
- * best, depending additionally wether it links with libcurl or not.
+ * best, depending additionally whether it links with libcurl or not.
*
* Caveat emptor. Proper curlx_* separation is a work in progress
* the same as CURLX_NO_MEMORY_CALLBACKS usage, some adjustments may
@@ -80,7 +83,20 @@
#ifndef CURLX_NO_MEMORY_CALLBACKS
-#include <curl/curl.h> /* for the callback typedefs */
+#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS /* only if not already done */
+/*
+ * The following memory function replacement typedef's are COPIED from
+ * curl/curl.h and MUST match the originals. We copy them to avoid having to
+ * include curl/curl.h here. We avoid that include since it includes stdio.h
+ * and other headers that may get messed up with defines done here.
+ */
+typedef void *(*curl_malloc_callback)(size_t size);
+typedef void (*curl_free_callback)(void *ptr);
+typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
+typedef char *(*curl_strdup_callback)(const char *str);
+typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
+#define CURL_DID_MEMORY_FUNC_TYPEDEFS
+#endif
extern curl_malloc_callback Curl_cmalloc;
extern curl_free_callback Curl_cfree;
@@ -119,11 +135,11 @@ extern curl_wcsdup_callback Curl_cwcsdup;
# define wcsdup(ptr) Curl_cwcsdup(ptr)
# undef _wcsdup
# define _wcsdup(ptr) Curl_cwcsdup(ptr)
-# undef wcsdup
-# define wcsdup(ptr) Curl_cwcsdup(ptr)
+# undef _tcsdup
+# define _tcsdup(ptr) Curl_cwcsdup(ptr)
# else
-# undef wcsdup
-# define wcsdup(ptr) Curl_cstrdup(ptr)
+# undef _tcsdup
+# define _tcsdup(ptr) Curl_cstrdup(ptr)
# endif
#endif