[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setsockopt on mingw
From: |
Ben Pfaff |
Subject: |
Re: setsockopt on mingw |
Date: |
Tue, 22 Apr 2008 09:28:01 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Simon Josefsson <address@hidden> writes:
> The follow patch appear to silent compiler warnings. Can anyone think
> of a better way to fix this? If not I'll commit and push this shortly.
[...]
> +# if defined _WIN32 || defined __WIN32__
> +# define setsockopt(a,b,c,d,e) setsockopt(a,b,c,(const void*)(d),e)
> +# endif
I do not know whether it is better, but the following is more
type-safe:
# if defined _WIN32 || defined __WIN32__
# define setsockopt(a,b,c,d,e) rpl_setsockopt(a,b,c,d,e)
static inline int
rpl_setsockopt(int socket, int level, int optname, const void *optval,
socklen_t optlen)
{
return (setsockopt)(socket, level, optname, optval, optlen);
}
# endif
(Funny, the glibc manual I have here omits the "const" from the
optval parameter.)
--
"Because computer source code is an expressive means for the exchange
of information and ideas about computer programming, we hold that it
is protected by the First Amendment."
--Hon. Boyce F. Martin, Jr., for the 6th Circuit Court, Junger vs. Daley