diff options
author | pranomostro <pranomostro@posteo.net> | 2017-11-09 12:18:22 +0100 |
---|---|---|
committer | pranomostro <pranomostro@posteo.net> | 2017-11-09 12:18:22 +0100 |
commit | 65b98f1691d2d5ec6f72034ed9509e3cb02fe075 (patch) | |
tree | 1f1ebdd96466095ffedd51672ebbf99d666f9dd8 | |
parent | 14bdd07ef831bff3bd163eb699d58f21fee42e57 (diff) |
Simplified unnecessary switch statement.
-rw-r--r-- | ratox.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -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)) { |