diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-01-03 20:04:33 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-01-08 17:46:04 -0800 |
commit | a4c12fe0ca5cb359bffe08b26a92ddcf8e194441 (patch) | |
tree | 2b4896ae2d5ed6ad0c175e239b53cb76661d75ac | |
parent | b6885f7aedc3b6eba62ffa1edac1e8488d938cea (diff) |
If EAGAIN == EWOULDBLOCK, only need to check errno for one of them
Solaris <sys/errno.h> has:
#define EWOULDBLOCK EAGAIN
so checking (errno == EAGAIN || errno == EWOULDBLOCK) is overkill.
This leads cppcheck 1.62 to complain:
[FSlibInt.c:153] -> [FSlibInt.c:153]: (style) Same expression on both sides of '||'.
[FSlibInt.c:301] -> [FSlibInt.c:301]: (style) Same expression on both sides of '||'.
[FSlibInt.c:379] -> [FSlibInt.c:379]: (style) Same expression on both sides of '||'.
[FSlibInt.c:472] -> [FSlibInt.c:472]: (style) Same expression on both sides of '||'.
This quiets it, and reduces the number of calls Solaris Studio cc
generates to the __errno() function to get the thread-specific errno value.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
-rw-r--r-- | src/FSlibInt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/FSlibInt.c b/src/FSlibInt.c index 0fabc96..cb53e44 100644 --- a/src/FSlibInt.c +++ b/src/FSlibInt.c @@ -66,11 +66,14 @@ static const char * _SysErrorMsg ( int n ); /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN + * + * Solaris defines EWOULDBLOCK to be EAGAIN, so don't need to check twice + * for it. */ #ifdef WIN32 #define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK) #else -#if defined(EAGAIN) && defined(EWOULDBLOCK) +#if defined(EAGAIN) && defined(EWOULDBLOCK) && (EAGAIN != EWOULDBLOCK) #define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK) #else #ifdef EAGAIN |