# HG changeset patch # User Simon Josefsson # Date 1208930984 -7200 # Node ID 2efe37d5c70dc858008dece1fb620c86fac8ba69 # Parent e624bf7756b15b492ee270a91927690b04cca790 Make setsockopt replacement more typesafe. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-23 Simon Josefsson + + * lib/sys_socket.in.h (setsockopt): Be more type safe by declaring + an inline function instead of a CPP macro. Patch by Ben Pfaff + . + 2008-04-23 Simon Josefsson * lib/arpa_inet.in.h: New file. diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -103,7 +103,13 @@ # endif # if defined _WIN32 || defined __WIN32__ -# define setsockopt(a,b,c,d,e) setsockopt(a,b,c,(const void*)(d),e) +# 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 #endif /* HAVE_SYS_SOCKET_H */