cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Allow compiler typechecking for CURL, CURLM and CURLSH

From: Reinhard Max <max_at_suse.de>
Date: Tue, 21 Jun 2016 16:21:52 +0200 (CEST)

After another glance over libcurl I think in addition to changing the
typedefs all uses of the typedef'ed names should be purged from the
implementation and replaced by the actual struct names.

This will be a larger change, but comes with the benefit of
simplifying the code by removing explicit typecasts while allowing
typechecking not only for the users of libcurl, but also throughout
the implementation.

So, e.g. ...

CURLMcode curl_multi_add_handle(CURLM *multi_handle,
                                 CURL *easy_handle)
{
   [...]
   struct Curl_multi *multi = (struct Curl_multi *)multi_handle;
   struct SessionHandle *data = (struct SessionHandle *)easy_handle;
   [...]
}

... would become ...

CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
                                 struct Curl_easy *data)
{
   [...]
   /* explicit typecasts from opaque to internal not needed anymore */
   [...]
}

... while the declaration in curl/multi.h stays the same as it is now:

CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
                                             CURL *curl_handle);

What do you think?

cu
         Reinhard
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-21