From 70189e759b0852614074c7f02ec69ce2e47edfbc Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 23 Apr 2008 08:09:44 +0200 Subject: [PATCH] Make setsockopt replacement more typesafe. --- ChangeLog | 6 ++++++ lib/sys_socket.in.h | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e0ac514e..4b87fda68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 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. * modules/arpa_inet (Files): Add lib/arpa_inet.in.h. diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index cb84220fe..d2a081fcd 100644 --- 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 */ -- 2.11.0