xz: Silence warnings from -Wlogical-op.

Thanks to Evan Nemerson.
This commit is contained in:
Lasse Collin 2016-06-16 22:46:02 +03:00
parent be647ff5ed
commit 1ddc479851
1 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,14 @@ static bool warn_fchown;
# define O_NOCTTY 0 # define O_NOCTTY 0
#endif #endif
// Using this macro to silence a warning from gcc -Wlogical-op.
#if EAGAIN == EWOULDBLOCK
# define IS_EAGAIN_OR_EWOULDBLOCK(e) ((e) == EAGAIN)
#else
# define IS_EAGAIN_OR_EWOULDBLOCK(e) \
((e) == EAGAIN || (e) == EWOULDBLOCK)
#endif
typedef enum { typedef enum {
IO_WAIT_MORE, // Reading or writing is possible. IO_WAIT_MORE, // Reading or writing is possible.
@ -1017,7 +1025,7 @@ io_read(file_pair *pair, io_buf *buf_union, size_t size)
} }
#ifndef TUKLIB_DOSLIKE #ifndef TUKLIB_DOSLIKE
if (errno == EAGAIN || errno == EWOULDBLOCK) { if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
const io_wait_ret ret = io_wait(pair, const io_wait_ret ret = io_wait(pair,
mytime_get_flush_timeout(), mytime_get_flush_timeout(),
true); true);
@ -1105,7 +1113,7 @@ io_write_buf(file_pair *pair, const uint8_t *buf, size_t size)
} }
#ifndef TUKLIB_DOSLIKE #ifndef TUKLIB_DOSLIKE
if (errno == EAGAIN || errno == EWOULDBLOCK) { if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
if (io_wait(pair, -1, false) == IO_WAIT_MORE) if (io_wait(pair, -1, false) == IO_WAIT_MORE)
continue; continue;