cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: status of CMake support in 7.19.5

From: Jamie Lokier <jamie_at_shareable.org>
Date: Wed, 10 Jun 2009 18:50:21 +0100

Bill Hoffman wrote:
> >curl_socklen_t should be the data type pointed by the third argument
> >of getpeername.
> >
>
> What about using the accept function:
> from curl/lib/ftp.c
> s=accept(sock, (struct sockaddr *) &add, &size);
>
> arg1 type = curl_socket_t
> arg2 type = (struct sockaddr *)
> size type = curl_socklen_t
>
> So, this could be done by only looping over these once:
>
> socklen_t int size_t 'unsigned int' long 'unsigned long' void
>
> It could be done after curl_socket_t is figured out.

It could be done after curl_socket_t is known, yes.

But you still need to loop over the second argument, in case it is
"void *", when using a function prototype to detect what the platform uses.

You can't just _call_ the function with the types being tried, because
that doesn't always detect when the third argument type is wrong.

Finally, I'm not sure now where, but I'm sure I've seen some configure
script which checks the socklen_t argument type separately for
different functions for some reason. Maybe some transitional/buggy OS
versions used socklen_t for some functions and int/size_t for some
others?

Keep in mind that it is almost always "int" and "struct sockaddr *"
for the first two arguments, so the loop doesn't _actually_ loop very
much if those are tried first.

-- Jamie
Received on 2009-06-10