summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-11-18 08:53:22 +0100
committerHaru <haru@dotalux.com>2013-11-19 03:41:30 +0100
commit12dce46d611d6ea7c772174ebbd555fa10fead99 (patch)
tree8f953e4166750c2ec1cbd1df89717b8d5dc8f455 /src/common/socket.c
parent51cbaf27c96e874850588ddcfa13b656db45bb2e (diff)
downloadhercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.gz
hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.bz2
hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.xz
hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.zip
Sanitized and improved several macros through the code
- Sanitized all potentially unsafe macros (related eA:15259) - Improved some function-like macros to evaluate their argument only once and keep it in a temporary variable. This improves performance in the damage calculation related code. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 6e877d9be..2ae9d44b3 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -157,19 +157,19 @@ char* sErr(int code)
return sbuf;
}
-#define sBind(fd,name,namelen) bind(fd2sock(fd),name,namelen)
-#define sConnect(fd,name,namelen) connect(fd2sock(fd),name,namelen)
-#define sIoctl(fd,cmd,argp) ioctlsocket(fd2sock(fd),cmd,argp)
-#define sListen(fd,backlog) listen(fd2sock(fd),backlog)
-#define sRecv(fd,buf,len,flags) recv(fd2sock(fd),buf,len,flags)
-#define sSelect select
-#define sSend(fd,buf,len,flags) send(fd2sock(fd),buf,len,flags)
-#define sSetsockopt(fd,level,optname,optval,optlen) setsockopt(fd2sock(fd),level,optname,optval,optlen)
-#define sShutdown(fd,how) shutdown(fd2sock(fd),how)
-#define sFD_SET(fd,set) FD_SET(fd2sock(fd),set)
-#define sFD_CLR(fd,set) FD_CLR(fd2sock(fd),set)
-#define sFD_ISSET(fd,set) FD_ISSET(fd2sock(fd),set)
-#define sFD_ZERO FD_ZERO
+#define sBind(fd,name,namelen) bind(fd2sock(fd),(name),(namelen))
+#define sConnect(fd,name,namelen) connect(fd2sock(fd),(name),(namelen))
+#define sIoctl(fd,cmd,argp) ioctlsocket(fd2sock(fd),(cmd),(argp))
+#define sListen(fd,backlog) listen(fd2sock(fd),(backlog))
+#define sRecv(fd,buf,len,flags) recv(fd2sock(fd),(buf),(len),(flags))
+#define sSelect select
+#define sSend(fd,buf,len,flags) send(fd2sock(fd),(buf),(len),(flags))
+#define sSetsockopt(fd,level,optname,optval,optlen) setsockopt(fd2sock(fd),(level),(optname),(optval),(optlen))
+#define sShutdown(fd,how) shutdown(fd2sock(fd),(how))
+#define sFD_SET(fd,set) FD_SET(fd2sock(fd),(set))
+#define sFD_CLR(fd,set) FD_CLR(fd2sock(fd),(set))
+#define sFD_ISSET(fd,set) FD_ISSET(fd2sock(fd),(set))
+#define sFD_ZERO FD_ZERO
/////////////////////////////////////////////////////////////////////
#else