xz: Silence warnings from -Wlogical-op.
Thanks to Evan Nemerson.
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index 493dca8..a8baa29 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -37,6 +37,14 @@
# define O_NOCTTY 0
#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 {
IO_WAIT_MORE, // Reading or writing is possible.
@@ -1017,7 +1025,7 @@
}
#ifndef TUKLIB_DOSLIKE
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
const io_wait_ret ret = io_wait(pair,
mytime_get_flush_timeout(),
true);
@@ -1105,7 +1113,7 @@
}
#ifndef TUKLIB_DOSLIKE
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
if (io_wait(pair, -1, false) == IO_WAIT_MORE)
continue;