Reviewed-by: Jasper St. Pierre <jstpie...@mecheye.net>
On Tue, Jan 7, 2014 at 7:02 PM, Alan Coopersmith < alan.coopersm...@oracle.com> wrote: > 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.coopersm...@oracle.com> > --- > src/FSlibInt.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > 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 > -- > 1.7.9.2 > > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel > -- Jasper
_______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel