]> diplodocus.org Git - nmh/commitdiff
uip/rcvtty.c: Flip logic, moving `return' to then-block.
authorRalph Corderoy <ralph@inputplus.co.uk>
Wed, 23 Aug 2017 20:38:55 +0000 (21:38 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Wed, 23 Aug 2017 22:31:42 +0000 (23:31 +0100)
There's then no need for an `else' around the old then-block.

    Before          After
    if (foo)        if (!foo)
        bar();          xyzzy();
    else                return;
        xyzzy();    bar();
        return;

uip/rcvtty.c

index 6991829..181c422 100644 (file)
@@ -303,17 +303,16 @@ alert (char *tty, int md)
     if (stat (ttyspec, &st) == NOTOK || (st.st_mode & mask) == 0)
        return;
 
-    if (!setjmp (myctx)) {
-       SIGNAL (SIGALRM, alrmser);
-       alarm (2);
-       td = open (ttyspec, O_WRONLY);
-       alarm (0);
-       if (td == NOTOK)
-           return;
-    } else {
+    if (setjmp (myctx)) {
        alarm (0);
        return;
     }
+    SIGNAL (SIGALRM, alrmser);
+    alarm (2);
+    td = open (ttyspec, O_WRONLY);
+    alarm (0);
+    if (td == NOTOK)
+        return;
 
     lseek(md, 0, SEEK_SET);