]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
include: revert 9adf3c4 and make public types void * again
authorDaniel Stenberg <daniel@haxx.se>
Sun, 31 Jul 2016 09:48:44 +0000 (11:48 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 31 Jul 2016 20:59:22 +0000 (22:59 +0200)
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
include/curl/multi.h

index 516ede6ae0eb5f614b36ffc2201188f6aac1c9fd..7fd6d1fa138703e8e54c53cbf5bdd56970784e31 100644 (file)
 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 */
index 7a1040f4661a92853db1f4f610b50844dede0f9b..d1e00cc5d38591bf52a75ebbe5fe605d41610113 100644 (file)
 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