diff options
author | sin <sin@2f30.org> | 2014-12-08 10:06:51 +0000 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-12-08 10:07:40 +0000 |
commit | 979500fb2d3fbf747907d22a4e9dcc3410e24aad (patch) | |
tree | e0c63370843d8eaa052daf9c579b2a568f950bed | |
parent | 18f4b52cbe8625a2af2e3436bc77924bd7f8bc65 (diff) |
Guard FD_APPEND with a do { } while(0)
-rw-r--r-- | ratox.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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]); } |