cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Allow compiler typechecking for CURL, CURLM and CURLSH

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 21 Jun 2016 16:52:28 +0200 (CEST)

On Tue, 21 Jun 2016, Reinhard Max wrote:

> 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.

We don't need to change them to gain that. We gain the type checks for the
library code the same way we gain it for external apps with those forward
declared structs. Those typedefs are used for libcurl code as well.

But we can happily remove a bunch of local declarations that are made and then
assigned the input argument just to convert them into the internal struct
pointers. I actually cleaned up a few of those up already in my
rename-SessionHandle patch. (See attachment for the gzipped version of the
360K monster)

That said, with the new typedef setup there's no _need_ to use them in the
libcurl code but there's also no harm in doing so as I see it.

I've not merged these patches yet as I want to give this thread some time to
allow others to chime in with opinions before I push.

-- 
  / daniel.haxx.se


-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2016-06-21