summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-12-08 10:06:51 +0000
committersin <sin@2f30.org>2014-12-08 10:07:40 +0000
commit979500fb2d3fbf747907d22a4e9dcc3410e24aad (patch)
treee0c63370843d8eaa052daf9c579b2a568f950bed /ratox.c
parent18f4b52cbe8625a2af2e3436bc77924bd7f8bc65 (diff)
Guard FD_APPEND with a do { } while(0)
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ratox.c b/ratox.c
index 02fb07b..ca6752e 100644
--- a/ratox.c
+++ b/ratox.c
@@ -222,8 +222,12 @@ static void initshutdown(int);
static void shutdown(void);
static void usage(void);
-#define FD_APPEND(fd) FD_SET((fd), &rfds); \
- if ((fd) > fdmax) fdmax = (fd);
+#define FD_APPEND(fd) do { \
+ FD_SET((fd), &rfds); \
+ if ((fd) > fdmax) \
+ fdmax = (fd); \
+ } while(0)
+
#undef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
@@ -1652,13 +1656,11 @@ loop(void)
FD_ZERO(&rfds);
fdmax = -1;
- for (i = 0; i < LEN(gslots); i++) {
+ for (i = 0; i < LEN(gslots); i++)
FD_APPEND(gslots[i].fd[IN]);
- }
- TAILQ_FOREACH(req, &reqhead, entry) {
+ TAILQ_FOREACH(req, &reqhead, entry)
FD_APPEND(req->fd);
- }
TAILQ_FOREACH(f, &friendhead, entry) {
/* File transfer cooldown */
@@ -1678,14 +1680,12 @@ loop(void)
FD_APPEND(f->fd[FTEXT_IN]);
if (f->tx.state == TRANSFER_NONE ||
- (f->tx.state == TRANSFER_INPROGRESS && !f->tx.cooldown)) {
+ (f->tx.state == TRANSFER_INPROGRESS && !f->tx.cooldown))
FD_APPEND(f->fd[FFILE_IN]);
- }
if (f->av.num < 0 ||
(toxav_get_call_state(toxav, f->av.num) == av_CallActive &&
- f->av.state & TRANSMITTING)) {
+ f->av.state & TRANSMITTING))
FD_APPEND(f->fd[FCALL_IN]);
- }
}
FD_APPEND(f->fd[FREMOVE]);
}