1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

include: revert 9adf3c4 and make public types void * again

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
This commit is contained in:
Daniel Stenberg 2016-07-31 11:48:44 +02:00
parent 2bbed9c4f0
commit d6604524ad
2 changed files with 10 additions and 1 deletions

View File

@ -91,7 +91,13 @@
extern "C" { extern "C" {
#endif #endif
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
typedef struct Curl_easy CURL; typedef struct Curl_easy CURL;
typedef struct Curl_share CURLSH;
#else
typedef void CURL;
typedef void CURLSH;
#endif
/* /*
* libcurl external API function linkage decorations. * libcurl external API function linkage decorations.
@ -2258,7 +2264,6 @@ typedef void (*curl_unlock_function)(CURL *handle,
curl_lock_data data, curl_lock_data data,
void *userptr); void *userptr);
typedef struct Curl_share CURLSH;
typedef enum { typedef enum {
CURLSHE_OK, /* all is fine */ CURLSHE_OK, /* all is fine */

View File

@ -52,7 +52,11 @@
extern "C" { extern "C" {
#endif #endif
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
typedef struct Curl_multi CURLM; typedef struct Curl_multi CURLM;
#else
typedef void CURLM;
#endif
typedef enum { typedef enum {
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or