]> diplodocus.org Git - nmh/commitdiff
Don't `else' after return. Simplify control flow.
authorRalph Corderoy <ralph@inputplus.co.uk>
Thu, 20 Oct 2016 22:22:00 +0000 (23:22 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Thu, 20 Oct 2016 22:34:05 +0000 (23:34 +0100)
sbr/netsec.c

index 990b231..8a0bba6 100644 (file)
@@ -627,7 +627,8 @@ retry:
            if (nsc->ns_snoop)
                ERR_print_errors_fp(stderr);
            return NOTOK;
            if (nsc->ns_snoop)
                ERR_print_errors_fp(stderr);
            return NOTOK;
-       } else if (rc < 0) {
+       }
+        if (rc < 0) {
            /* Definitely an error */
            netsec_err(errstr, "Read on TLS connection failed: %s",
                       ERR_error_string(ERR_get_error(), NULL));
            /* Definitely an error */
            netsec_err(errstr, "Read on TLS connection failed: %s",
                       ERR_error_string(ERR_get_error(), NULL));
@@ -826,19 +827,18 @@ retry:
                       "%d bytes, but our buffer size was only %d bytes",
                       rc, nsc->ns_outbufsize);
            return NOTOK;
                       "%d bytes, but our buffer size was only %d bytes",
                       rc, nsc->ns_outbufsize);
            return NOTOK;
-       } else {
-           /*
-            * Generate a flush (which may be inefficient, but hopefully
-            * it isn't) and then try again.
-            */
-           if (netsec_flush(nsc, errstr) != OK)
-               return NOTOK;
-           /*
-            * After this, outbuffer should == outptr, so we shouldn't
-            * hit this next time around.
-            */
-           goto retry;
        }
        }
+        /*
+         * Generate a flush (which may be inefficient, but hopefully
+         * it isn't) and then try again.
+         */
+        if (netsec_flush(nsc, errstr) != OK)
+            return NOTOK;
+        /*
+         * After this, outbuffer should == outptr, so we shouldn't
+         * hit this next time around.
+         */
+        goto retry;
     }
 
     if (nsc->ns_snoop) {
     }
 
     if (nsc->ns_snoop) {
@@ -1534,13 +1534,12 @@ netsec_set_tls(netsec_context *nsc, int tls, char **errstr)
        BIO_set_ssl(ssl_bio, ssl, BIO_CLOSE);
        nsc->ssl_io = ssl_bio;
 
        BIO_set_ssl(ssl_bio, ssl, BIO_CLOSE);
        nsc->ssl_io = ssl_bio;
 
-       return OK;
-    } else {
-       BIO_free_all(nsc->ssl_io);
-       nsc->ssl_io = NULL;
-
        return OK;
     }
        return OK;
     }
+    BIO_free_all(nsc->ssl_io);
+    nsc->ssl_io = NULL;
+
+    return OK;
 #else /* TLS_SUPPORT */
        netsec_err(errstr, "TLS is not supported");
 
 #else /* TLS_SUPPORT */
        netsec_err(errstr, "TLS is not supported");