From cf2c7d48380969200034afeab93169e68c34c397 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 23 Dec 2020 17:39:01 -0800 Subject: [clang-tidy] Do not use else after return Signed-off-by: Rosen Penev --- tools/idevicebackup2.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'tools/idevicebackup2.c') diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index d1ef0d6..ec7eacd 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -184,9 +184,8 @@ static int mkdir_with_parents(const char *dir, int mode) if (!dir) return -1; if (__mkdir(dir, mode) == 0) { return 0; - } else { - if (errno == EEXIST) return 0; } + if (errno == EEXIST) return 0; int res; char *parent = strdup(dir); char *parentdir = dirname(parent); @@ -973,10 +972,12 @@ static int mb2_receive_filename(mobilebackup2_client_t mobilebackup2, char** fil if ((nlen == 0) && (rlen == 4)) { // a zero length means no more files to receive return 0; - } else if(rlen == 0) { + } + if (rlen == 0) { // device needs more time, waiting... continue; - } else if (nlen > 4096) { + } + if (nlen > 4096) { // filename length is too large printf("ERROR: %s: too large filename length (%d)!\n", __func__, nlen); return 0; @@ -1368,7 +1369,8 @@ static void get_hidden_input(char *buf, int maxlen) while ((c = my_getch())) { if ((c == '\r') || (c == '\n')) { break; - } else if (isprint(c)) { + } + if (isprint(c)) { if (pwlen < maxlen-1) buf[pwlen++] = c; fputc('*', stderr); @@ -1961,15 +1963,16 @@ int main(int argc, char *argv[]) if (aerr == AFC_E_SUCCESS) { do_post_notification(device, NP_SYNC_DID_START); break; - } else if (aerr == AFC_E_OP_WOULD_BLOCK) { + } + if (aerr == AFC_E_OP_WOULD_BLOCK) { usleep(LOCK_WAIT); continue; - } else { - fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); - afc_file_close(afc, lockfile); - lockfile = 0; - cmd = CMD_LEAVE; } + + fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); + afc_file_close(afc, lockfile); + lockfile = 0; + cmd = CMD_LEAVE; } if (i == LOCK_ATTEMPTS) { fprintf(stderr, "ERROR: timeout while locking for sync\n"); @@ -2103,9 +2106,8 @@ checkpoint: if (write_restore_applications(info_plist, afc) < 0) { cmd = CMD_LEAVE; break; - } else { - PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n"); } + PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n"); } /* Start restore */ -- cgit v1.1-32-gdbae