From 0a6e66f8b794de76bd48bda199977b977a377e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=C3=A6r=C3=B8y?= Date: Fri, 21 Oct 2016 17:56:29 +0200 Subject: Kill do { ... } while (0); and replace it with goto's. --- src/core/network-openssl.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index df84772c..7a1d6e34 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -776,34 +776,32 @@ int irssi_ssl_handshake(GIOChannel *handle) ret = 1; - do { - if (pinned_cert_fingerprint != NULL && pinned_cert_fingerprint[0] != '\0') { - ret = g_ascii_strcasecmp(pinned_cert_fingerprint, tls->certificate_fingerprint) == 0; + if (pinned_cert_fingerprint != NULL && pinned_cert_fingerprint[0] != '\0') { + ret = g_ascii_strcasecmp(pinned_cert_fingerprint, tls->certificate_fingerprint) == 0; - if (! ret) { - g_warning(" Pinned certificate mismatch"); - continue; - } + if (! ret) { + g_warning(" Pinned certificate mismatch"); + goto done; } + } - if (pinned_pubkey_fingerprint != NULL && pinned_pubkey_fingerprint[0] != '\0') { - ret = g_ascii_strcasecmp(pinned_pubkey_fingerprint, tls->public_key_fingerprint) == 0; + if (pinned_pubkey_fingerprint != NULL && pinned_pubkey_fingerprint[0] != '\0') { + ret = g_ascii_strcasecmp(pinned_pubkey_fingerprint, tls->public_key_fingerprint) == 0; - if (! ret) { - g_warning(" Pinned public key mismatch"); - continue; - } + if (! ret) { + g_warning(" Pinned public key mismatch"); + goto done; } + } - if (chan->verify) { - ret = irssi_ssl_verify(chan->ssl, chan->ctx, chan->server->connrec->address, chan->port, cert, chan->server, tls); + if (chan->verify) { + ret = irssi_ssl_verify(chan->ssl, chan->ctx, chan->server->connrec->address, chan->port, cert, chan->server, tls); - if (! ret) { - // irssi_ssl_verify emits a warning itself. - continue; - } + if (! ret) { + // irssi_ssl_verify emits a warning itself. + goto done; } - } while (0); + } done: tls_rec_free(tls); -- cgit v1.2.3