From: Alessandro Ghedini Date: Tue, 13 Sep 2016 23:51:02 +0000 (+0100) Subject: Use switch instead of multiple ifs X-Git-Tag: OpenSSL_1_1_1-pre1~3519 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1586%2Fhead;p=thirdparty%2Fopenssl.git Use switch instead of multiple ifs Makes the logic a little bit clearer. Reviewed-by: Andy Polyakov Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1571) --- diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index 3df4ce61e11..df3008575d1 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -566,22 +566,24 @@ static SUB_STATE_RETURN read_state_machine(SSL *s) /* Discard the packet data */ s->init_num = 0; - if (ret == MSG_PROCESS_ERROR) { + switch (ret) { + case MSG_PROCESS_ERROR: return SUB_STATE_ERROR; - } - if (ret == MSG_PROCESS_FINISHED_READING) { + case MSG_PROCESS_FINISHED_READING: if (SSL_IS_DTLS(s)) { dtls1_stop_timer(s); } return SUB_STATE_FINISHED; - } - if (ret == MSG_PROCESS_CONTINUE_PROCESSING) { + case MSG_PROCESS_CONTINUE_PROCESSING: st->read_state = READ_STATE_POST_PROCESS; st->read_state_work = WORK_MORE_A; - } else { + break; + + default: st->read_state = READ_STATE_HEADER; + break; } break;