From 65b98f1691d2d5ec6f72034ed9509e3cb02fe075 Mon Sep 17 00:00:00 2001 From: pranomostro Date: Thu, 9 Nov 2017 12:18:22 +0100 Subject: Simplified unnecessary switch statement. --- ratox.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'ratox.c') diff --git a/ratox.c b/ratox.c index 44a185b..cf4d38c 100644 --- a/ratox.c +++ b/ratox.c @@ -2214,21 +2214,17 @@ loop(void) ftmp = TAILQ_NEXT(f, entry); if (FD_ISSET(f->fd[FTEXT_IN], &rfds)) sendfriendtext(f); - if (FD_ISSET(f->fd[FFILE_IN], &rfds)) { - switch (f->tx.state) { - case TRANSFER_NONE: - /* Prepare a new transfer */ - snprintf(tstamp, sizeof(tstamp), "%lu", (unsigned long)time(NULL)); - f->tx.fnum = tox_file_send(tox, f->num, TOX_FILE_KIND_DATA, UINT64_MAX, - NULL, (uint8_t *)tstamp, strlen(tstamp), NULL); - if (f->tx.fnum == UINT32_MAX) { - weprintf("Failed to initiate new transfer\n"); - fiforeset(f->dirfd, &f->fd[FFILE_IN], ffiles[FFILE_IN]); - } else { - f->tx.state = TRANSFER_INITIATED; - logmsg(": %s : Tx > Initiated\n", f->name); - } - break; + if (FD_ISSET(f->fd[FFILE_IN], &rfds) && f->tx.state == TRANSFER_NONE) { + /* Prepare a new transfer */ + snprintf(tstamp, sizeof(tstamp), "%lu", (unsigned long)time(NULL)); + f->tx.fnum = tox_file_send(tox, f->num, TOX_FILE_KIND_DATA, UINT64_MAX, + NULL, (uint8_t *)tstamp, strlen(tstamp), NULL); + if (f->tx.fnum == UINT32_MAX) { + weprintf("Failed to initiate new transfer\n"); + fiforeset(f->dirfd, &f->fd[FFILE_IN], ffiles[FFILE_IN]); + } else { + f->tx.state = TRANSFER_INITIATED; + logmsg(": %s : Tx > Initiated\n", f->name); } } if (FD_ISSET(f->fd[FCALL_IN], &rfds)) { -- cgit v1.2.3