Make setsockopt replacement more typesafe.
authorSimon Josefsson <simon@josefsson.org>
Wed, 23 Apr 2008 06:09:44 +0000 (08:09 +0200)
committerSimon Josefsson <simon@josefsson.org>
Wed, 23 Apr 2008 06:09:44 +0000 (08:09 +0200)
ChangeLog
lib/sys_socket.in.h

index 2e0ac514e11331abbdcf6c7d50eacb489f5d546a..4b87fda6847fa7720b5d057cc62456ad6222284f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-23  Simon Josefsson  <simon@josefsson.org>
+
+       * lib/sys_socket.in.h (setsockopt): Be more type safe by declaring
+       an inline function instead of a CPP macro.  Patch by Ben Pfaff
+       <blp@cs.stanford.edu>.
+
 2008-04-23  Simon Josefsson  <simon@josefsson.org>
 
        * lib/arpa_inet.in.h: New file.
index cb84220fe8789c5be874af2146db9dc4f817e2c7..d2a081fcdf7c13507367babc76eae1caf8403b1f 100644 (file)
 # 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 */