From d6604524ad24daf4581efbe0020da058d2b3af84 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 31 Jul 2016 11:48:44 +0200 Subject: [PATCH] include: revert 9adf3c4 and make public types void * again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many applications assume the actual contents of the public types and use that do for example forward declarations (saving them from including our public header) which then breaks when we switch from void * to a struct *. I'm not convinced we were wrong, but since this practise seems widespread enough I'm willing to (partly) step down. Now libcurl uses the struct itself when it is built and it allows applications to use the struct type if CURL_STRICTER is defined at the time of the #include. Reported-by: Peter Frühberger Fixes #926 --- include/curl/curl.h | 7 ++++++- include/curl/multi.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index 516ede6ae..7fd6d1fa1 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -91,7 +91,13 @@ extern "C" { #endif +#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) typedef struct Curl_easy CURL; +typedef struct Curl_share CURLSH; +#else +typedef void CURL; +typedef void CURLSH; +#endif /* * libcurl external API function linkage decorations. @@ -2258,7 +2264,6 @@ typedef void (*curl_unlock_function)(CURL *handle, curl_lock_data data, void *userptr); -typedef struct Curl_share CURLSH; typedef enum { CURLSHE_OK, /* all is fine */ diff --git a/include/curl/multi.h b/include/curl/multi.h index 7a1040f46..d1e00cc5d 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -52,7 +52,11 @@ extern "C" { #endif +#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) typedef struct Curl_multi CURLM; +#else +typedef void CURLM; +#endif typedef enum { CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or